simulate_CR_data {adjSURVCI}R Documentation

Simulate stratified clustered competing risks data

Description

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.

Usage

simulate_CR_data(
  n = 4,
  m = 100,
  alpha = 1,
  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)
)

Arguments

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. 1/alpha must be an integer such that alpha = 0.25, 0.5 and 1. alpha=1 generates independent data. As alpha decreases, the correlation within a cluster increases. Default is 1.

beta1

This is a vector of values of length 3. This value multiplied by alpha is a true covariate effect for Cause 1.

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 alpha is a true covariate effect for censoring. A marginal proportional hazards model is used to generate clustered censoring times based on Logan et al. (2011).

lambdaC

Constant baseline hazard for censoring for the marginal proportional hazards model.

stratified

It is TRUE for stratified data. Two strata are considered. If TRUE, the remaining parameters must be provided.

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.

Value

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 stratified=TRUE.

References

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

Examples

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))

[Package adjSURVCI version 1.0 Index]