bcfraildv: Semi-parametric bivariate correlated frailty models fit.

View source: R/bcfraildv.R

bcfraildvR Documentation

Semi-parametric bivariate correlated frailty models fit.

Description

Fit a semiparametric Bivariate correlated frailty model with Proportional Hazard structure. Here, frailty variances of pairs can be different.

Usage

bcfraildv(
  formula,
  data,
  initfrailp = NULL,
  frailty = c("gamma", "lognormal"),
  control = bcfraildv.control(),
  comonvar = FALSE,
  ...
)

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. If not specified, initial frailty parameters will be obtained from bcfrailph fit for gamma model and from coxph with univariate frailty model and for correlation c(0) for lognormal model.

frailty

A type of frailty distribution to be used in fit. Either gamma or lognormal. The default is gamma.

control

Arguments to control bcfraildv fit. The default is bcfraildv.control.

comonvar

An argument whether to assume common frailty variance. The default is comonvar=FALSE. If comonvar=TRUE, then the result of bcfrailph fit is displayed.

...

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.

  • 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, 0 if converge and 1 otherwise.

Note

Parameters of Bivariate correlated gamma frailty model was estimated using a modified EM approach given in Kifle et al (2022) with modification for different frailty variances in a pair. Parameters of Bivariate correlated lognormal frailty model is based on the penalized partial likelihood approach by Rippatti and Palmgren (2000).

References

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.

See Also

bcfrailph, simbcfraildv

Examples

set.seed(4)
simdata<-simbcfraildv(psize=300, 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=bcfraildv(Surv(time,censor)~ X1+frailty(PID) ,data=dataa,frailty="gamma")
fitbcfrail


# for lognormal

set.seed(18)
simdata<-simbcfraildv(psize=100, cenr= c(0.2),beta=c(1,-0.7,0.5),
frailty=c("lognormal"),frailpar=c(0.5,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=bcfraildv(Surv(time,censor)~ X1+X2+X3+frailty(PID) ,data=dataa,frailty="lognormal")
fitbcfrlogn

set.seed(4)
simdata<-simbcfraildv(psize=300, 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

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

# Not run

#if covariates are not included
fitmoe=try(bcfraildv(Surv(time,censor)~0+frailty(PID),data=dataa,
frailty="lognormal"),silent = TRUE)

fitmoe=try(bcfraildv(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(bcfraildv(Surv(time,censor)~ X1+frailty(PID),data=dataa,
control=c(max.iter=100)),silent = TRUE)

#the correct way is
fitmoe=bcfraildv(Surv(time,censor)~ X1+frailty(PID),data=dataa,
control=bcfraildv.control(max.iter=100))
fitmoe

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

fitmoe=try(bcfraildv(Surv(time,censor)~ X1+frailty(PID),data=dataa,
initfrailp=c(0,0.5,0.1)),silent = TRUE)

#if a frailty distribution other than gamma and lognormal are specified

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

# End Not run



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