Learn R Programming

SemiCompRisks (version 2.4)

simSurv: The function that simulates independent/cluster-correlated right-censored survival data under Weibull/Weibull-Normal model.

Description

The function to simulate independent/cluster-correlated right-censored survival data under Weibull/Weibull-Normal model.

Usage

simSurv(cluster=NULL, x, beta.true, alpha.true, kappa.true, sigmaV.true=NULL, cens)

Arguments

cluster
a vector of cluster information for n subjects. The cluster membership must be set to consecutive positive integers, $1:J$. Required only when generating clustered data.
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$.
sigmaV.true
true value for $\sigma_V$. Required only when generating clustered data.
cens
a vector with two numeric elements. The right censoring times are generated from Uniform($cens[1]$, $cens[2]$).

Value

  • simSurv returns a data.frame containing univariate time-to-event outcomes from n subjects. It is of dimension $n\times 2$: the columns correspond to $y$, $\delta$.
  • ya vector of n times to the event
  • deltaa vector of n censoring indicators for the event time (1=event occurred, 0=censored)

Examples

Run this code
set.seed(123456)
	
	J = 110
	nj = 50
	n = J * nj

	cluster <- rep(1:J, each = nj)	

	x	= matrix(0, n, 2)	
	x[,1]	= rnorm(n, 0, 2)	
	x[,2]	= sample(c(0, 1), n, replace = TRUE)

	beta.true = c(0.5, 0.5)
	
	alpha.true = 1.5		
	kappa.true = 0.02
	sigmaV.true = 0.1

	cens <- c(30, 40)		

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

Run the code above in your browser using DataLab