simulate_surv_data {adjSURVCI}R Documentation

Simulate stratified and clustered survival data

Description

The function simulate_surv_data simulates survival data based on a marginal proportional hazards model based on Logan et al. (2011).

Usage

simulate_surv_data(
  N = 100,
  alpha = 1,
  beta1 = 1 * 1/alpha,
  beta2 = -1 * 1/alpha,
  beta3 = 0.5 * 1/alpha,
  rateC = 0.01,
  stratified = TRUE,
  lambda0 = 1,
  lambda1 = 2
)

Arguments

N

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 value multiplied by alpha is the true value of normally distributed covariate effect.

beta2

This value multiplied by alpha is the true value of uniformly distributed covariate effect.

beta3

This value multiplied the alpha is the true value of bernoulli distributed covariate effect.

rateC

Rate of exponential distribution to generate censoring times. Default is 0.01.

stratified

It is TRUE for stratified data. Two strata are considered.

lambda0

Constant baseline hazard for first stratum. If stratified=FALSE, then lambda0 is used as a constant basline hazard.

lambda1

Constant baseline hazard for second stratum.

Value

Returns a data frame with the following variables:

cluster

Cluster variable

times

Survival times

delta

Event indicator with Event=1 and Censoring=0

Z1

Standard normal covariate

Z2

Cluster level covariate generated from uniform distribution

Z3

Bernoulli distributed covariate with probability 0.6

s

Stratification variable. This is provided only when 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

#Stratified data
alpha = 0.5
d = simulate_surv_data(N=200,alpha=alpha,beta1=0.5*1/alpha,beta2=-0.5*1/alpha,
beta3=1/alpha,rateC=1.3,lambda0=1,lambda1=2,stratified = TRUE)

#Unstratified data
d = simulate_surv_data(N=200,alpha=alpha,beta1=0.5*1/alpha,beta2=-0.5*1/alpha,
beta3=1/alpha,rateC=0.9,lambda0=1,lambda1=2,stratified = FALSE)

[Package adjSURVCI version 1.0 Index]