bcfrailpar: Parametric bivariate correlated frailty models fit.

View source: R/bcfrailpar.R

bcfrailparR Documentation

Parametric bivariate correlated frailty models fit.

Description

Fit a parametric Bivariate correlated gamma, inverse gaussian and power variance frailty models with Proportional Hazard structure.

Usage

bcfrailpar(
  formula,
  data,
  initfrailp = NULL,
  inithazp = NULL,
  initbeta = NULL,
  haz = c("weibull", "gompertz", "exponential"),
  frailty = c("gamma", "invgauss", "pv"),
  comonvar = TRUE,
  ...
)

Arguments

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. The default is c(0.5,0.5).

inithazp

Initial estimates for the baseline hazard distribution parameters. The default is c(0.05) for both scale and shape parameters.

initbeta

Initial estimates for the covariate coefficients if there are any included. The default is taken from coxph fit.

haz

A baseline hazard distribution. Either weibull, gompertz or exponential distributions are possible.

frailty

A type of frailty distribution. Either gamma, inverse gaussian frailty="invgauss" or power variance frailty="pv" frailty distributions are possible.

comonvar

An argument whether to assume common frailty variance. The default is comonvar=TRUE. If comonvar=FALSE, then only gamma frailty model is possible.

...

further arguments.

Value

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.

  • basehazpar - A vector of estimated baseline hazard parameters i.e. scale and shape.

  • stderr-A vector containing the Standard errors of the Estimated parameters with the order of frailty parameters,baseline hazard parameters and covariate coefficients.

  • vcov- Variance Covariance matrix of the Estimated parameters.

  • loglik-Log likelihood of the model.

  • AIC-AIC of the model.

  • BIC-BIC of the model.

  • iterations-Number of outer iterations.SeeconstrOptim for further.

  • convergence-An indicator of convergence. SeeconstrOptim for further.

Examples

set.seed(4)
simdata<-simbcfraildv(psize=500, cenr= c(0.3),beta=c(2),frailty=c("gamma"),
frailpar=c(0.5,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

fitbcfrail=bcfrailpar(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frailty="gamma")
fitbcfrail



set.seed(18)
simdata<-simbcfraildv(psize=300, cenr= c(0.3),beta=c(2),frailty=c("gamma"),
frailpar=c(0.5,0.5,0.4),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

#fit with power variance frailty distribution
fitbcfrail=bcfrailpar(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,
frailty="pv")
fitbcfrail

## one can set the initial parameter for the frailty parameters
fitbcfrail=bcfrailpar(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,initfrailp = c(0.4,0.3),
frailty="gamma")
fitbcfrail

# Not run

#if initial frailty parameters are in the boundary of parameter space
fitmoe=try(bcfrailpar(Surv(time,censor)~ X1+frailty(PID),data=dataa,
initfrailp=c(0.2,1)),silent = TRUE)

#if a frailty distribution other than gamma, invgauss or pv is specified

fitmoe=try(bcfrailpar(Surv(time,censor)~ X1,data=dataa,frailty="exp"),silent = TRUE)

# End Not run



bcfrailphdv documentation built on Dec. 28, 2022, 2:10 a.m.