| simbcfrailph {bcfrailph} | R Documentation |
Simulate data from bivariate correlated frailty models.
Description
Simulate data from bivariate correlated gamma or lognormal frailty models with or without covariates.
Usage
simbcfrailph(
psize,
cenr = c(0),
beta = c(0.5),
frailty,
frailpar = c(0.5, 0.25),
bhaz = c("weibull"),
bhazpar = list(shape = c(0.5), scale = c(0.01)),
covartype = c("B"),
covarpar = list(fargs = c(1), sargs = c(0.5)),
inpcovar = NULL,
inpcen = NULL,
comncovar = NULL
)
Arguments
psize |
pair size. |
cenr |
censored rate. The default is zero.. |
beta |
Covariate coefficient. |
frailty |
A type of frailty distribution to be used. Either gamma or lognormal. |
frailpar |
vector of frailty parameters, variance and correlation respectively. The default is c(0.5,0.25) meaning variance 0.5 and correlation 0.25. |
bhaz |
A type of baseline hazard distribution to be used. it can be weibull, gompertz or exponential. |
bhazpar |
is a |
covartype |
specified the distribution from which covariate(s) are goining to be sampled. covartype can be c("B","N","U")denoting binomial, normal or uniform, respectively. For example, |
covarpar |
is a |
inpcovar |
is a |
inpcen |
is a |
comncovar |
if common covariates are needed. |
Value
An object of class simbcfrailph that contain the following:
dataA data frame i.e, the simulated data set. IID is individual Id, PID is pair ID, time is the simulated survival time, censor is censoring indicator and X1 denote the simulated covariate.XCovariates in Matrix form.YA matrix contains generated survival time and censoring.numberofpairThe specified number of pairs.censoredrateThe specified censored rate.fraildistThe specified frailty distribution.frailparThe specified frailty parameters.
See Also
Examples
set.seed(4)
simdata<-simbcfrailph(psize=300, cenr= c(0.3),beta=c(2),frailty=c("gamma"),
frailpar=c(0.5,0.5),bhaz=c("weibull"),
bhazpar=list(shape =c(5), scale = c(0.1)),
covartype= c("B"),covarpar=list(fargs=c(1),sargs=c(0.5)))
dataa<-simdata$data
head(dataa)
# If data generation is from bivariate correlated lognormal frailty model,
set.seed(18)
simdata<-simbcfrailph(psize=100, cenr= c(0.2),beta=c(1,-0.7,0.5),frailty=c("lognormal"),
frailpar=c(0.5,-0.25),bhaz=c("exponential"),
bhazpar=list(scale = c(0.1)),covartype= c("N","N","B"),
covarpar=list(fargs=c(0,0,1),sargs=c(1,1,0.5)))
dataa<-simdata$data
head(dataa)
# If common covariate is desired, i.e., here out of
#the three covariates covariate 2 is common for the pair.
set.seed(18)
simdata<-simbcfrailph(psize=100, cenr= c(0.2),beta=c(1,-0.7,0.5),frailty=c("lognormal"),
frailpar=c(0.5,-0.25),bhaz=c("exponential"),
bhazpar=list(scale = c(0.1)),covartype= c("N","N","B"),
covarpar=list(fargs=c(0,0,1),sargs=c(1,1,0.5)),comncovar=2)
dataa<-simdata$data
head(dataa)
# If the data generation is from bivariate correlated gamma
# frailty model, weibull baseline and without covariate,
set.seed(4)
simdata<-simbcfrailph(psize=300, cenr= c(0.3),beta=NULL,frailty=c("gamma"),
frailpar=c(0.5,0.5),bhaz=c("weibull"),bhazpar=list(shape =c(5), scale = c(0.1)))
dataa<-simdata$data
head(dataa)