Learn R Programming

SemiCompRisks (version 1.0)

simID: The function to simulate semi-competing risks data under Weibull model

Description

The function to simulate semi-competing risks data under Weibull model

Usage

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)

Arguments

x1
Covariate matrix, n observations by p1 variables
x2
Covariate matrix, n observations by p2 variables
x3
Covariate matrix, n observations by p3 variables
beta1.true
True value for $\beta_1$
beta2.true
True value for $\beta_2$
beta3.true
True value for $\beta_3$
alpha1.true
True value for $\alpha_1$
alpha2.true
True value for $\alpha_2$
alpha3.true
True value for $\alpha_3$
kappa1.true
True value for $\kappa_1$
kappa2.true
True value for $\kappa_2$
kappa3.true
True value for $\kappa_3$
gamma.true
True value for $\gamma$
cens
A vector with two numeric elements. The right censoring times are generated from Uniform($cens[1]$, $cens[2]$)

Value

  • simID returns an object of class simID
  • y1a vector of n times to the non-terminal event
  • y2a vector of n times to the terminal event
  • delta1a vector of n censoring indicators for the non-terminal event time (1=event occurred, 0=censored)
  • delta2a vector of n censoring indicators for the terminal event time (1=event occurred, 0=censored)

References

Lee, K. H., Haneuse, S., Schrag, D., and Dominici, F. (2013). Bayesian Semi-parametric Analysis of Semi-competing Risks Data: Estimating Readmission Rates among Pancreatic Cancer Patients, submitted.

Examples

Run this code
### 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