Description Usage Arguments Value References Examples
View source: R/simulate_CR_data.R
The function simulate_CR_data
simulates stratified competing risks data with two causes based
on a proportional subdistribution hazard model based on Logan et al. (2011).
Three covariates (Bernoulli, Normal and Uniform) are considered.
1 2 3 4 5 6 7 8 9 10 11 12 |
n |
Number of observations in each cluster. Default is 4. |
m |
Total number of clusters. Default is 100. |
alpha |
Parameter for a positive stable distribution. It controls correlation within a cluster.
|
beta1 |
This is a vector of values of length 3. This value multiplied by |
beta2 |
This is a vector of values of length 3. It is a true covariate effect for Cause 2. |
betaC |
This is a vector of values of length 3. This value multiplied by |
lambdaC |
Constant baseline hazard for censoring for the marginal proportional hazards model. |
stratified |
It is |
rho |
Baseline hazard for each stratum. Must be a vector of length two. |
lambdaC0 |
Constant baseline hazard of censoring for each stratum. Must be a vector of length two. |
Returns a data frame with the following variables:
time |
Survival times |
cause |
Different causes of an event. Censoring is 0. The main cause is 1 |
Z1 |
Bernoulli distributed covariate with probability 0.6 |
Z2 |
Standard normal covariate |
Z3 |
Uniform distributed covariate |
cluster |
Cluster variable |
strata |
Strata variable. Only if |
Logan BR, Zhang MJ, Klein JP. Marginal models for clustered time-to-event data with competing risks using pseudovalues. Biometrics. 2011;67(1):1-7. doi:10.1111/j.1541-0420.2010.01416.x
1 2 3 4 5 6 7 8 9 | alpha = 0.5
#Simulate unstratified clustered competing risks data
d1 = simulate_CR_data(n=4,m=100,alpha=alpha,beta1=c(0.7,-0.7,-0.5)*1/alpha,beta2=c(0.5,-0.5,1),
betaC=c(0,0,0)*1/alpha,lambdaC=0.59,stratified=FALSE)
#Simulate stratified clustered competing risks data
d2 = simulate_CR_data(n=4,m=100,alpha=alpha,beta1=c(0.7,-0.7,-0.5)*1/alpha,beta2=c(0.5,-0.5,1),
betaC=c(0,0,0)*1/alpha,lambdaC=0.59,stratified=TRUE,rho=c(2,4),lambdaC0=c(0.9,2.5))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.