gen.data: Generate Data for BivPPL

Description Usage Arguments Value Examples

View source: R/Gaussian_PPL_src.R

Description

Generate input data for BivPPL

Usage

1
gen.data(N, beta1, beta2, theta,lambda01,lambda02, c = 10, Ctype = TRUE, const_cov = F, same_cov = F)

Arguments

N

Sample size for alternating recurrent events, or number of clusters for other bivariate clustered events

beta1

Regression parameters for event type 1.

beta2

Regression parameters for event type 2.

theta

A vector of 3 entries in the variance-covariance matrix of the bivariate frailty vector. The first two are variance values for the first and second event types, and the third is the covariance.

c

Maximum censoring time.

Ctype

logical; if TRUE, fixed censoring time at c; or if FALSE, randomly draw from a uniform(0,c).

const_cov

logical; if TRUE, the covariates are not updated across the event times.

same_cov

logical; if TRUE, the covariates are shared between two event types.

Value

a list object of data that recorded all the covariates, event times, indicators, and the true frailty values.

x

a list of follow-up time for the first event type

y

a list of follow-up time for the second event type

z1

a list of covariats for event type 1

z2

a list of covariats for event type 2

delta1

a list of type 1 event status

delta1

a list of type 2 event status

r

true values of the bivariate frailties

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(100)
N<-100 # number of clusters
beta1 <- c(0.5,-0.3,0.5) # regression parameters for event type 1
beta2 <- c(0.8,-0.2,0.3) # regression parameters for event type 2
beta  <- c(beta1,beta2)
theta <- c(0.25,0.25,-0.125) # variance-covariance matrix for the bivariate frailty (denoted as D), it is a vector (D[1,1],D[2,2], D[1,2])
lambda01 <- 1
lambda02 <- 1
cen <- 10 # maximum censoring time
centype <- TRUE # fixed censoring time at cen

data <- gen.data(N,beta1,beta2,theta,lambda01,lambda02,c=cen,Ctype=centype)
ptm<-proc.time()
res <- BivPPL(data)
proc.time() - ptm
res$beta_hat
res$beta_ASE
res$D_hat

lilywang1988/BivPPL documentation built on Aug. 9, 2019, 6:14 p.m.