Title: | Semiparametric Bivariate Correlated Frailty Models Fit |
---|---|
Description: | Fit and simulate a semiparametric bivariate correlated frailty models with proportional hazard structure. Frailty distributions, such as gamma and lognormal models are supported. Bivariate gamma fit is obtained using the approach given in Iachine (1995) and lognormal fit is based on the approach by Ripatti and Palmgren (2000) <doi:10.1111/j.0006-341X.2000.01016.x>. |
Authors: | Mesfin Tsegaye [aut, cre], Yehenew Kifle [aut, ctb] |
Maintainer: | Mesfin Tsegaye <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2024-12-25 06:34:33 UTC |
Source: | CRAN |
Fit a semiparametric Bivariate correlated frailty model with Proportional Hazard structure.
bcfrailph( formula, data, initfrailp = NULL, frailty = c("gamma", "lognormal"), weights = NULL, control = bcfrailph.control(), ... )
bcfrailph( formula, data, initfrailp = NULL, frailty = c("gamma", "lognormal"), weights = NULL, control = bcfrailph.control(), ... )
formula |
A formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the Surv function. |
data |
A dataframe contain survival time, censor, covariate etc with data in columns. |
initfrailp |
Initial estimates for the frailty parameters. If not specified, initial frailty variance will be obtained from coxph with univariate frailty model and for correlation c(0.5) will be used. |
frailty |
A type of frailty distribution to be used in fit. Either gamma or lognormal. The default is gamma. |
weights |
vector of case weights for gamma model. the default is NULL. |
control |
Arguments to control bcfrailph fit. The default is |
... |
further arguments |
An object of that contains the following components.
coefficients
- A vector of estimated Covariate coefficients.
frailparest
- A vector of estimated Frailty parameters i.e. frailty variance and correlation.
stderr
-A vector containing the Standard error of the Estimated parameters both covariate coefficients and frailty parameters.
loglilk0
- Log likelihood of without frailty model or loglik of coxph fit.
loglilk
-Log likelihood of Cox PH model with frailty.
Iloglilk
- Log likelihood of with frailty. For gamma fit it is I-likelihood or the likelihood after integrating out the frailty term.For lognormal fit it is the approximate likelihood.
bhaz
- an array containing unique event times and estimated baseline hazard.
X
-Matrix of observed covariates.
time
-the observed survival time.
censor
-censoring indicator.
resid
-the martingale residuals.
lin.prid
-the vector of linear predictors.
frail
-estimated Frailty values.
iteration
-Number of outer iterations.
e.time
-the vector of unique event times.
n.event
- the number of events at each of the unique event times.
convergence
-an indicator, 1 if converge and 0 otherwise.
history
-an array containing records of estimates and other information on each iterations.
Parameters of Bivariate correlated gamma frailty model was estimated using a modified EM approach given in Kifle et al (2022). Parameters of Bivariate correlated lognormal frailty model is based on the penalized partial likelihood approach by Rippatti and Palmgren (2000).
Kifle YG, Chen DG, Haileyesus MT (2022). Multivariate Frailty Models using Survey Weights with Applications to Twins Infant Mortality in Ethiopia. Statistics and Its Interface,106(4), 1\-10.
Rippatti, S. and Palmgren, J (2000). Estimation of multivariate frailty models using penalized partial likelihood. Biometrics, 56: 1016-1022.
bcfrailph.control
,simbcfrailph
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 fitbcfrgam=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frailty="gamma") fitbcfrgam # for lognormal 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 #fit fitbcfrlogn=bcfrailph(Surv(time,censor)~ X1+X2+X3+frailty(PID) ,data=dataa,frailty="lognormal") fitbcfrlogn ## one can set the initial parameter for the frailty parameters fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa,initfrailp = c(0.1,0.5), frailty="lognormal") fitbcfrailph # Not run #if covariates are not included fitmoe=try(bcfrailph(Surv(time,censor)~0+frailty(PID),data=dataa, frailty="lognormal"),silent = TRUE) fitmoe=try(bcfrailph(Surv(time,censor)~1+frailty(PID),data=dataa),silent = TRUE) # if control is not specified correctly. # if one needs to change only max.iter to be 100, fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, control=c(max.iter=100)),silent = TRUE) #the correct way is fitmoe=bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, control=bcfrailph.control(max.iter=100)) fitmoe #if initial frailty parameters are in the boundary of parameter space fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, initfrailp=c(0.2,1)),silent = TRUE) fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, initfrailp=c(0,0.1)),silent = TRUE) #if a frailty distribution other than gamma and lognormal are specified fitmoe=try(bcfrailph(Surv(time,censor)~ X1,data=dataa,,frailty="exp"),silent = TRUE) # End Not run
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 fitbcfrgam=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frailty="gamma") fitbcfrgam # for lognormal 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 #fit fitbcfrlogn=bcfrailph(Surv(time,censor)~ X1+X2+X3+frailty(PID) ,data=dataa,frailty="lognormal") fitbcfrlogn ## one can set the initial parameter for the frailty parameters fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa,initfrailp = c(0.1,0.5), frailty="lognormal") fitbcfrailph # Not run #if covariates are not included fitmoe=try(bcfrailph(Surv(time,censor)~0+frailty(PID),data=dataa, frailty="lognormal"),silent = TRUE) fitmoe=try(bcfrailph(Surv(time,censor)~1+frailty(PID),data=dataa),silent = TRUE) # if control is not specified correctly. # if one needs to change only max.iter to be 100, fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, control=c(max.iter=100)),silent = TRUE) #the correct way is fitmoe=bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, control=bcfrailph.control(max.iter=100)) fitmoe #if initial frailty parameters are in the boundary of parameter space fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, initfrailp=c(0.2,1)),silent = TRUE) fitmoe=try(bcfrailph(Surv(time,censor)~ X1+frailty(PID),data=dataa, initfrailp=c(0,0.1)),silent = TRUE) #if a frailty distribution other than gamma and lognormal are specified fitmoe=try(bcfrailph(Surv(time,censor)~ X1,data=dataa,,frailty="exp"),silent = TRUE) # End Not run
This is used to set various numeric parameters controlling a bcfrailph model fits.
bcfrailph.control( max.iter = 400, tol = 1e-04, eval.max = 500, iter.max = 500, trace = 0, abs.tol = 1e-20, rel.tol = 1e-10, x.tol = 1.5e-08, xf.tol = 2.2e-14, step.min = 1, step.max = 1 )
bcfrailph.control( max.iter = 400, tol = 1e-04, eval.max = 500, iter.max = 500, trace = 0, abs.tol = 1e-20, rel.tol = 1e-10, x.tol = 1.5e-08, xf.tol = 2.2e-14, step.min = 1, step.max = 1 )
max.iter |
Maximum number of outer iterations. The default is 400. |
tol |
A tolerance for convergence i.e the maximum differences of loglikelihood between succssive iterations.The default is 1e-04. |
eval.max |
argument used to control nlminb fits used. |
iter.max |
argument used to control nlminb fits used. |
trace |
argument used to control nlminb fits used. |
abs.tol |
argument used to control nlminb fits used. |
rel.tol |
argument used to control nlminb fits used. |
x.tol |
argument used to control nlminb fits used. |
xf.tol |
argument used to control nlminb fits used. |
step.min |
argument used to control nlminb fits used. |
step.max |
argument used to control nlminb fits used. |
A list of control parameters.
Semi-parametric Bivariate correlated gamma frailty model fitting function.
fitbccv.gammasp( X, Y, initfrailp, weights = NULL, control = bcfrailph.control(), SE = TRUE )
fitbccv.gammasp( X, Y, initfrailp, weights = NULL, control = bcfrailph.control(), SE = TRUE )
X |
Matix of predictors. This should not include an intercept. |
Y |
a Surv object containing 2 columns (coxph.fit). |
initfrailp |
Initial estimates for the frailty parameters. If not specified, initial frailty variance will be obtained from coxph with univariate gamma frailty model and for correlation c(0.5) will be used. |
weights |
vector of case weights. the default is NULL. |
control |
Arguments to control the fit. The default is |
SE |
a logical statement whether standard errors are obtained from the mariginal log likelihood.The default is TRUE. |
An object of that contains the following components.
coefficients
- A vector of estimated Covariate coefficients.
frailparest
- A vector of estimated Frailty parameters i.e. frailty variance and correlation.
stderr
-A vector containing the Standard error of the Estimated parameters both covariate coefficients and frailty parameters.
loglilk0
- Log likelihood of without frailty model or loglik of coxph fit.
loglilk
-Log likelihood of Cox PH model with frailty.
Iloglilk
- Log likelihood of with frailty. For gamma fit it is I-likelihood or the likelihood after integrating out the frailty term.For lognormal fit it is the approximate likelihood.
bhaz
- an array containing unique event times and estimated baseline hazard.
X
-Matrix of observed covariates.
time
-the observed survival time.
censor
-censoring indicator.
resid
-the martingale residuals.
lin.prid
-the vector of linear predictors.
frail
-estimated Frailty values.
iteration
-Number of outer iterations.
e.time
-the vector of unique event times.
n.event
- the number of events at each of the unique event times.
convergence
-an indicator, 1 if converge and 0 otherwise.
history
-an array containing records of estimates and other information on each iterations.
This function is important especially for simulation studies as it reduced checking time. Parameters of Bivariate correlated gamma frailty model was estimated using a modified EM approach given in Kifle et al (2022).
Kifle YG, Chen DG, Haileyesus MT (2022). Multivariate Frailty Models using Survey Weights with Applications to Twins Infant Mortality in Ethiopia. Statistics and Its Interface,106(4), 1\-10.
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))) Y<-simdata$Y;X<-simdata$X bcspfit<-fitbccv.gammasp(X=X,Y=Y,initfrailp=NULL) bcspfit$coef bcspfit$frailpar
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))) Y<-simdata$Y;X<-simdata$X bcspfit<-fitbccv.gammasp(X=X,Y=Y,initfrailp=NULL) bcspfit$coef bcspfit$frailpar
Semi-parametric Bivariate correlated lognormal frailty model fitting function.
fitbccv.lognsp(X, Y, initfrailp, control = bcfrailph.control())
fitbccv.lognsp(X, Y, initfrailp, control = bcfrailph.control())
X |
Matix of predictors. This should not include an intercept. |
Y |
a Surv object containing 2 columns (coxph.fit). |
initfrailp |
Initial estimates for the frailty parameters. If not specified, initial frailty variance will be obtained from coxph with univariate lognormal frailty model and for correlation c(0.5) will be used. |
control |
Arguments to control the fit. The default is |
An object of that contains the following components.
coefficients
- A vector of estimated Covariate coefficients.
frailparest
- A vector of estimated Frailty parameters i.e. frailty variance and correlation.
stderr
-A vector containing the Standard error of the Estimated parameters both covariate coefficients and frailty parameters.
loglilk0
- Log likelihood of without frailty model or loglik of coxph fit.
loglilk
-Log likelihood of Cox PH model with frailty.
Iloglilk
- Log likelihood of with frailty. For gamma fit it is I-likelihood or the likelihood after integrating out the frailty term.For lognormal fit it is the approximate likelihood.
bhaz
- an array containing unique event times and estimated baseline hazard.
X
-Matrix of observed covariates.
time
-the observed survival time.
censor
-censoring indicator.
resid
-the martingale residuals.
lin.prid
-the vector of linear predictors.
frail
-estimated Frailty values.
iteration
-Number of outer iterations.
e.time
-the vector of unique event times.
n.event
- the number of events at each of the unique event times.
convergence
-an indicator, 1 if converge and 0 otherwise.
history
-an array containing records of estimates and other information on each iterations.
This function is important especially for simulation studies as it reduced checking time. Parameters of Bivariate correlated lognormal frailty model is based on the penalized partial likelihood approach by Rippatti and Palmgren (2000).
Rippatti, S. and Palmgren, J (2000). Estimation of multivariate frailty models using penalized partial likelihood. Biometrics, 56: 1016-1022.
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) Y<-simdata$Y;X<-simdata$X bcspfit<-fitbccv.lognsp(X=X,Y=Y,initfrailp=NULL) bcspfit$coef bcspfit$frailpar
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) Y<-simdata$Y;X<-simdata$X bcspfit<-fitbccv.lognsp(X=X,Y=Y,initfrailp=NULL) bcspfit$coef bcspfit$frailpar
Generics to print the S3 class bcfrailph.
## S3 method for class 'bcfrailph' plot( x, lty = 1, col = 1, type = "l", xlim = NULL, ylim = NULL, xlab = NULL, main = NULL, conf.int = FALSE, ... )
## S3 method for class 'bcfrailph' plot( x, lty = 1, col = 1, type = "l", xlim = NULL, ylim = NULL, xlab = NULL, main = NULL, conf.int = FALSE, ... )
x |
A class |
lty |
Line type line type 1 is a solid line (the default). |
col |
Colors to be used for points. |
type |
The type of plot produced. type="l" Plot lines (the default) and type="p" Plot individual points. |
xlim |
range of variable on the x axis. |
ylim |
range of variable on the y axis. |
xlab |
Axis label for the x axis. |
main |
main is a string for figure title, placed at the top of the plot in a large font. |
conf.int |
whether confidence interval is included in the plot the deafault is FALSE. |
... |
ignored |
Calls plot.bcfrailph()
.
An plot of plot.bcfrailph
object.
The plot of cumulative baseline hazard function.
set.seed(24) simdata<-simbcfrailph(psize=100, cenr= c(0),beta=c(-1),frailty=c("gamma"), frailpar=c(0.4,0.5),bhaz=c("weibull"), bhazpar=list(shape =c(0.9), scale = c(2)), covartype= c("B"),covarpar=list(fargs=c(1),sargs=c(0.5))) dataa<-simdata$data ## the generated data set. #fit bcfit=bcfrailph(Surv(time, censor) ~ X1+frailty(PID),data=dataa) plot(bcfit)
set.seed(24) simdata<-simbcfrailph(psize=100, cenr= c(0),beta=c(-1),frailty=c("gamma"), frailpar=c(0.4,0.5),bhaz=c("weibull"), bhazpar=list(shape =c(0.9), scale = c(2)), covartype= c("B"),covarpar=list(fargs=c(1),sargs=c(0.5))) dataa<-simdata$data ## the generated data set. #fit bcfit=bcfrailph(Surv(time, censor) ~ X1+frailty(PID),data=dataa) plot(bcfit)
Generics to print the S3 class bcfrailph.
## S3 method for class 'bcfrailph' print(x, ...)
## S3 method for class 'bcfrailph' print(x, ...)
x |
A class |
... |
ignored |
Calls print.bcfrailph()
.
An object of print.bcfrailph
, with some more human-readable results from bcfrailph
object.
The summary function is currently identical to the print function.
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 fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frail_distrn=c("gamma")) fitbcfrailph
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 fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frail_distrn=c("gamma")) fitbcfrailph
Generics to print the S3 class shrgamsp.
## S3 method for class 'shrgamsp' print(x, ...)
## S3 method for class 'shrgamsp' print(x, ...)
x |
A class |
... |
ignored |
Calls print.shrgamsp()
.
An object of print.shrgamsp
, with some more human-readable results from shrgamsp
object.
The summary function is currently identical to the print function.
Fit Cox PH model with univariate and bivariate shared gamma frailty model.
shrgamsp( formula, data, weights = NULL, initfrailp = NULL, control = bcfrailph.control(), ... )
shrgamsp( formula, data, weights = NULL, initfrailp = NULL, control = bcfrailph.control(), ... )
formula |
A formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the |
data |
A dataframe contain survival time, censor, covariate etc with data in columns. |
weights |
vector of case weights for gamma model. the default is NULL. |
initfrailp |
Initial estimates for the frailty parameters. The default is c(0.5). |
control |
Arguments to control the fit. The default is |
... |
further arguments |
An object of shrgamsp contains the following components.
coefficients
- A vector of estimated Covariate coefficients.
frailparest
- A vector of estimated Frailty parameters i.e. frailty variance and correlation.
vcov
- Variance Covariance matrix of the Estimated Covariate coefficients obtained from the observed information matrix.
stderr
-A vector containing the Standard error of the Estimated parameters both covariate coefficients and frailty parameter.
loglik0
- Log likelihood of without frailty model.
loglik
-Log likelihood of Cox PH model with frailty.
Iloglilk
- Log likelihood of with frailty model after integrating out the frailty term.
bhaz
- an array containing unique event times and estimated baseline hazard.
X
-Matrix of observed covariates.
time
-the observed survival time.
censor
-censoring indicator.
resid
-the martingale residuals.
lin.prid
-the vector of linear predictors.
frail
-estimated Frailty values.
iteration
-Number of outer iterations.
e.time
-the vector of unique event times.
n.event
- the number of events at each of the unique event times.
convergence
-an indicator of convergence . see nlminb
.
This is just a coxph
model with gamma frailty and the differences between
coxph
with gamma frailty fit and shrgamsp
fit is on the standard errors of the
covariates cofficients. Here, the standard errors of the estimated covariate coefficients and the frailty variance parameter are obtained using
the standard errors estimation approach given in Klein and Moeschberger (2003).
Duchateau, L., Janssen, P. (2008) The Frailty Model. Springer, New York.
Klein, J. P., and Moeschberger, M. L. (2003), Survival analysis: techniques for censored and truncated data, New York: Springer.
set.seed(2) n1=500;IID=array(1:n1) X1<-runif(n1, min=0, max=1) z=rgamma(n1,shape=2,scale=0.5) u1<-runif(n1, min=0, max=1) time<- 1/0.1*log(1-0.1*log(u1)/(0.0001*exp(3*X1)*z)) censor=rep(1,n1) dataa <- data.frame(time=time, X1=X1,censor=censor,IID=IID) fitcoxfr=shrgamsp(Surv(time,censor)~ X1+frailty(IID) ,data=dataa) fitcoxfr
set.seed(2) n1=500;IID=array(1:n1) X1<-runif(n1, min=0, max=1) z=rgamma(n1,shape=2,scale=0.5) u1<-runif(n1, min=0, max=1) time<- 1/0.1*log(1-0.1*log(u1)/(0.0001*exp(3*X1)*z)) censor=rep(1,n1) dataa <- data.frame(time=time, X1=X1,censor=censor,IID=IID) fitcoxfr=shrgamsp(Surv(time,censor)~ X1+frailty(IID) ,data=dataa) fitcoxfr
Simulate data from bivariate correlated gamma or lognormal frailty models with or without covariates.
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 )
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 )
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. |
An object of class simbcfrailph
that contain the following:
data
A 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.
X
Covariates in Matrix form.
Y
A matrix contains generated survival time and censoring.
numberofpair
The specified number of pairs.
censoredrate
The specified censored rate.
fraildist
The specified frailty distribution.
frailpar
The specified frailty parameters.
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)
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)
Simulation study for bivariate correlated gamma and lognormal frailty models with and without covariates.
simstdybcf( Rep, mfit = NULL, 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 )
simstdybcf( Rep, mfit = NULL, 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 )
Rep |
number of replications. |
mfit |
A type of frailty model to be fit in addition to |
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. |
An object of class simstdybcf
that contain the following:
Result
a summary result containing true parameter, mean of estimates, mean of the standard errors of the estimates, standard deviation of estimates, and 95% CI coverage probability.
estimates
a matrix containing estimates of parameters at each replications.
estimateSE
a matrix containing standard error of estimates at each replications.
coverage
a matrix containing an indicator whether the true parameter lies within a 95% CI at each replications or not.
TMAT
a matrix containing the generated artificial unique event times at each replications for gamma model.
h0MAT
a matrix containing the estimated baseline hazards at each replications for gamma model.
h0SEMAT
a matrix containing SE of the estimated baseline hazards at each replications for gamma model.
set.seed(2) sim<-simstdybcf(Rep=5,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) Res<-sim$Result Res # In addition to bcfrailph fit, if coxph with univariate lognormal frailty model is desired to run, sim<-simstdybcf(Rep=5,mfit="cox",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) Res<-sim$Result # bcfrailph fit result Res Resc<-sim$Resultc # coxph with univariate lognormal frailty model fit result Resc
set.seed(2) sim<-simstdybcf(Rep=5,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) Res<-sim$Result Res # In addition to bcfrailph fit, if coxph with univariate lognormal frailty model is desired to run, sim<-simstdybcf(Rep=5,mfit="cox",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) Res<-sim$Result # bcfrailph fit result Res Resc<-sim$Resultc # coxph with univariate lognormal frailty model fit result Resc
Generics to print the S3 class bcfrailph.
## S3 method for class 'bcfrailph' summary(object, ...)
## S3 method for class 'bcfrailph' summary(object, ...)
object |
A class |
... |
ignored |
Calls print.bcfrailph()
.
An object of summary.bcfrailph
, with some more human-readable results from bcfrailph
object.
The summary function is currently identical to the print function.
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 fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frail_distrn=c("gamma")) fitbcfrailph summary(fitbcfrailph)
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 fitbcfrailph=bcfrailph(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frail_distrn=c("gamma")) fitbcfrailph summary(fitbcfrailph)
Generics to print the S3 class shrgamsp.
## S3 method for class 'shrgamsp' summary(object, ...)
## S3 method for class 'shrgamsp' summary(object, ...)
object |
A class |
... |
ignored |
Calls print.shrgamsp()
.
An object of summary.shrgamsp
, with some more human-readable results from shrgamsp
object.
The summary function is currently identical to the print function.