### simulating semi-competing risks data ###
set.seed(123456)
n = 2000
p1 = 2
p2 = 2
p3 = 2
x = matrix(0, n, p1)
x[,1] = rnorm(n, 0, 2)
x[,2] = sample(c(0, 1), n, replace = TRUE)
x1 = as.matrix(x, ncol = p1)
x2 = as.matrix(x, ncol = p2)
x3 = as.matrix(x, ncol = p3)
# - true value of parameter
beta1.true = c(0.5, 0.5)
beta2.true = c(0.5, 0.5)
beta3.true = c(1, 1)
theta.true = 2
gamma.true = rgamma(n, shape = 1/theta.true, rate = 1/theta.true)
alpha1.true = 1.5
alpha2.true = 0.8
alpha3.true = 0.5
kappa1.true = 0.02
kappa2.true = 0.1
kappa3.true = 0.15
cens <- c(30, 40)
simData <- simID(x1, x2, x3, beta1.true, beta2.true, beta3.true, alpha1.true,
alpha2.true, alpha3.true, kappa1.true, kappa2.true, kappa3.true,
gamma.true, cens)
summary(simData)
Run the code above in your browser using DataLab