simbcfrailph {bcfrailph}R Documentation

Simulate data from bivariate correlated frailty models.

Description

Simulate data from bivariate correlated gamma or lognormalfrailty models with one covariate.

Usage

simbcfrailph(
  p.size,
  c.rate = c(0),
  fraildistrn,
  frail.par = c(0.5, 0.25),
  bhaz.arg = list(distrn = c("weibull"), shape = c(2.5), scale = c(0.01), rate =
    c(0.5)),
  covar.arg = list(coefs = c(0.5), types = c("B", "U"), size = 1, prob = 0.5, min = 0,
    max = 3)
)

Arguments

p.size

pair size.

c.rate

censored rate. The default is zero..

fraildistrn

A type of frailty distribution to be used. Either gamma or lognormal.

frail.par

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

is a list i.e,list(distrn = c("weibull"),shape =c(2.5), scale = c(0.01), rate = c(0.5)).distrn is the type of baseline hazard to be used. weibull, gompertz and exponential is possible. shape, scale and rate are the parameters of the coresponding baseline hazard parameters. rate needs to be specified if the baseline is exponential.

covar.arg

is a list i.e,coefs is covariate coefficient, types is the type of covariate to be used. B is for binomial and U is for uniform.size and prob needs to be specified if the covariate is binomial and if the covariate is uniform, then min and max should be specified.

Value

An object of class simbcfrailph that contain the following:

See Also

bcfrailph

Examples

simdata<-simbcfrailph(p.size=1000, c.rate= c(0.2),fraildistrn=c("gamma"),frail.par=c(0.5,0.5),
bhaz.arg=list(distrn = c("gompertz"),shape =c(3), scale = c(0.1)),
covar.arg=list(coefs=c(1),types = c("U"),min=0,max=1))
simdata


#Let us simulate a data set with the following parameters
#weibull baseline hazard with parameters shape= 2.5 and scale=0.01.
#a dataset with 1000 pairs. Frailty distribution is gamma
# and the frailty parameters are taken to
#be variance=0.4 and correlation =0.6. One binomial covariate i.e,
#(Binomial (1,0.5)) with regression coefficient 0.5.
#Each observed covariate for the two individuals in a
#pair is taken to be independent and 20 percent of the observations are censored.

#simulate the data set
#first for gamma

simdata<-simbcfrailph(p.size=1000, c.rate= c(0.2),fraildistrn=c("gamma"),frail.par=c(0.4,0.6),
bhaz.arg=list(distrn = c("weibull"),shape =c(2.5), scale = c(0.01)),
covar.arg=list(coefs=c(0.5),types = c("B"),size=1,prob=0.5))
simdata  # a list contain the parameters set by user and the simulated data set

#to extract the simulated data set
dataa<-simdata$data ## the simulated data set
dataa[1:4,] # the first four rows looks like

#    IID PID     time censor X1
#  1   1   1 1.793324      0  0
#  2   2   1 5.245163      1  1
#  3   3   2 6.730729      1  0
#  4   4   2 4.963159      1  0

# IID is individual indicator
# PID is pair indicator
# time is the simulated survival time
# censor is the simulated censoring indicator
# X1 is the simulated covariate

# if lognormal frailty is desired

simdata<-simbcfrailph(p.size=1000, c.rate= c(0.2),fraildistrn=c("lognormal"),frail.par=c(0.4,0.6),
bhaz.arg=list(distrn = c("weibull"),shape =c(2.5), scale = c(0.01)),
covar.arg=list(coefs=c(0.5),types = c("B"),size=1,prob=0.5))
dataa<-simdata$data ## the simulated data set

# Not run
# if p.size, pair size missed
simdata<-simbcfrailph( c.rate= c(0.2),fraildistrn=c("gamma"),frail.par=c(0.4,0.6),
covar.arg=list(coefs=c(0.5),types = c("B"),size=1,prob=0.5))

# if frailty distribution other than gamma and lognormal specified
simdata<-simbcfrailph(p.size=100, c.rate= c(0.2),fraildistrn=c("exp"),frail.par=c(0.4,0.6),
covar.arg=list(coefs=c(0.5),types = c("B"),size=1,prob=0.5))
# End Not run



[Package bcfrailph version 0.1.0 Index]