simSurv: The function that simulates independent/cluster-correlated...

Description Usage Arguments Value Author(s) Examples

View source: R/simSurv.R

Description

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

Usage

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

Arguments

id

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 β.

alpha.true

true value for α.

kappa.true

true value for κ.

sigmaV.true

true value for σ_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, δ.

y

a vector of n times to the event

delta

a vector of n censoring indicators for the event time (1=event occurred, 0=censored)

Author(s)

Kyu Ha Lee and Sebastien Haneuse
Maintainer: Kyu Ha Lee <klee15239@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
	set.seed(123456)
	
	J = 110
	nj = 50
	n = J * nj

	id <- 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(id, x, beta.true, alpha.true, kappa.true, 
				sigmaV.true, cens) 		 

SemiCompRisks documentation built on Feb. 3, 2021, 5:06 p.m.