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

Description Usage Arguments Value Author(s) Examples

View source: R/simID.R

Description

The function to simulate independent/cluster-correlated semi-competing risks data under semi-Markov Weibull/Weibull-MVN models.

Usage

1
2
3
4
simID(id=NULL, x1, x2, x3, beta1.true, beta2.true, beta3.true,
			alpha1.true, alpha2.true, alpha3.true, 
			kappa1.true, kappa2.true, kappa3.true, 
			theta.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.

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

beta2.true

true value for β_2.

beta3.true

true value for β_3.

alpha1.true

true value for α_1.

alpha2.true

true value for α_2.

alpha3.true

true value for α_3.

kappa1.true

true value for κ_1.

kappa2.true

true value for κ_2.

kappa3.true

true value for κ_3.

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

simIDcor returns a data.frame containing semi-competing risks outcomes from n subjects. It is of dimension n\times 4: the columns correspond to y_1, δ_1, y_2, δ_2.

y1

a vector of n times to the non-terminal event

y2

a vector of n times to the terminal event

delta1

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

delta2

a vector of n censoring indicators for the terminal 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
23
24
25
26
27
28
29
30
31
32
33
	library(MASS)
	set.seed(123456)
	
	J = 110
	nj = 50
	n = J * nj

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

	kappa1.true <- 0.05
	kappa2.true <- 0.01
	kappa3.true <- 0.01
	alpha1.true <- 0.8
	alpha2.true <- 1.1
	alpha3.true <- 0.9
	beta1.true <- c(0.5, 0.8, -0.5)
	beta2.true <- c(0.5, 0.8, -0.5)
	beta3.true <- c(1, 1, -1)
	SigmaV.true <- matrix(0.25,3,3)
	theta.true <- 0.5
	cens <- c(90, 90)

	cov1 <- matrix(rnorm((length(beta1.true)-1)*n, 0, 1), n, length(beta1.true)-1)
	cov2 <- sample(c(0, 1), n, replace = TRUE)
	x1 <- as.data.frame(cbind(cov1, cov2))
	x2 <- as.data.frame(cbind(cov1, cov2))
	x3 <- as.data.frame(cbind(cov1, cov2))
	
	simData <- simID(id, x1, x2, x3, beta1.true, beta2.true, beta3.true, 
				alpha1.true, alpha2.true, alpha3.true, 
				kappa1.true, kappa2.true, kappa3.true, 
				theta.true, SigmaV.true, cens)	
   				    				

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