CompAREdesign: Simulations

Simulations

## Probabilities of observing the event in control arm during follow-up
p0_e1 <- 0.59   # Death
p0_e2 <- 0.74   # Disease Progression  

## Effect size (Cause specific hazard ratios) for each endpoint
HR_e1 <- 0.91   # Death
HR_e2 <- 0.77   # Disease Progression

## Hazard rates over time
beta_e1 <- 2    # Death --> Increasing risk over time
beta_e2 <- 1    # Disease Progression --> Constant risk over time

## Correlation
rho      <- 0.1        # Correlation between components
rho_type <- 'Spearman' # Type of correlation measure
copula   <- 'Frank'    # Copula used to get the joint distribution

## Additional parameter
case  <- 3  # 1: No deaths;                  2: Death is the secondary event; 
            # 3: Death is the primary event; 4: Both events are death by different causes

## Sample size
sample_size <- 100

## Effect size for each endpoint
eff_e1 <- -0.0196  
eff_e2 <- -0.0098

Simulation of composite time-to-event endpoints

simulation_timetoevent<- simula_tte(p0_e1, 
                                    p0_e2, 
                                    HR_e1, 
                                    HR_e2, 
                                    beta_e1 = 1, 
                                    beta_e2 = 1, 
                                    case, 
                                    copula = "Frank", 
                                    rho = 0.3, 
                                    rho_type = "Spearman", 
                                    followup_time = 1, 
                                    sample_size)
head(simulation_timetoevent)
##       time_e1 status_e1     time_e2 status_e2     time_ce status_ce treated
## 1 0.926591689         1 0.001893297         1 0.001893297         1       0
## 2 0.003151729         1 0.315942026         1 0.003151729         1       0
## 3 1.000000000         0 0.326341426         1 0.326341426         1       0
## 4 0.058951845         1 0.041262698         1 0.041262698         1       0
## 5 0.773331231         1 0.095865371         1 0.095865371         1       0
## 6 0.031138715         1 0.099793426         1 0.031138715         1       0