Learn R Programming

SemiCompRisks (version 1.0)

simSurv: The function to simulate right censored survival data under Weibull model

Description

The function to simulate right censored survival data under Weibull model

Usage

simSurv(x, beta.true, alpha.true, kappa.true, cens)

Arguments

x
Covariate matrix, n observations by p variables
beta.true
True value for $\beta$
alpha.true
True value for $\alpha$
kappa.true
True value for $\kappa$
cens
A vector with two numeric elements. The right censoring times are generated from Uniform($cens[1]$, $cens[2]$)

Value

  • simSurv returns an object of class simSurv
  • ya vector of n times to the event
  • deltaa vector of n censoring indicators for the 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 survival data ###
	
	set.seed(123456)
	
	n = 2000
	p = 2

	x	= matrix(0, n, p)	
	x[,1]	= rnorm(n, 0, 2)	
	x[,2]	= sample(c(0, 1), n, replace = TRUE)
			
	# - true value of parameter
	
	beta.true = c(0.5, 0.5)
	
	alpha.true = 1.5		
	kappa.true = 0.02

	cens <- c(30, 40)		

	simData <- simSurv(x, beta.true, alpha.true, kappa.true, cens) 
	
   	summary(simData)

Run the code above in your browser using DataLab