Package 'extrafrail'

Title: Estimation and Additional Tools for Alternative Shared Frailty Models
Description: Provide estimation and data generation tools for some new multivariate frailty models. This version includes the gamma, inverse Gaussian, weighted Lindley, Birnbaum-Saunders, truncated normal, mixture of inverse Gaussian and mixture of Birnbaum-Saunders as the distribution for the frailty terms. For the basal model, it is considered a parametric approach based on the exponential, Weibull and the piecewise exponential distributions as well as a semiparametric approach. For details, see Gallardo and Bourguignon (2022) <doi:10.48550/arXiv.2206.12973> and Gallardo et al. (2024) <doi:10.1007/s11222-024-10458-w>.
Authors: Diego Gallardo [aut, cre], Marcelo Bourguignon [aut]
Maintainer: Diego Gallardo <[email protected]>
License: GPL (>= 2)
Version: 1.12
Built: 2024-11-23 06:48:28 UTC
Source: CRAN

Help Index


Computes the baseline cumulative hazard function.

Description

Provides the baseline cumulative hazard function (Λ0\Lambda_0) for an object with extrafrail class.

Usage

baseCH(t, fit)

Arguments

t

the vector of times for which the baseline cumulative hazard function should be computed.

fit

an object with extrafrail class.

Details

Provides the baseline cumulative hazard function. When the baseline distribution is assumed as the Weibull model, this function is Λ0(t)=λtρ\Lambda_0(t)=\lambda t^{\rho}. For the piecewise exponential model, this function is Λ0(t)=j=1Lλjj(t)\Lambda_0(t)=\sum_{j=1}^L \lambda_j \nabla_j(t), where j(t)=0,\nabla_j(t)=0, if t<aj1t<a_{j-1}, j(t)=taj1,\nabla_j(t)=t-a_{j-1}, if aj1t<aja_{j-1}\leq t < a_{j} and j(t)=ajaj1,\nabla_j(t)=a_j-a_{j-1}, if tajt\geq a_{j}, with a=(a0=0,a1,,aj1),a=(a_0=0, a_1, \ldots, a_{j-1}), the corresponding partition time.

Value

a vector with the same length that t, including the baseline cumulative hazard function related to t.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Gallardo, D.I., Bourguignon, M. (2022) The multivariate weighted Lindley frailty model for cluster failure time data. Submitted.

Examples

#require(frailtypack)
require(survival)
data(rats, package="frailtyHL")
#Example for WL frailty model
fit.WL <- frailty.fit(survival::Surv(time, status) ~ rx + survival::cluster(litter), 
dist.frail="WL", data = rats)
baseCH(c(80,90,100),fit.WL)

Fitted different shared frailty models

Description

frailty.fit computes the maximum likelihood estimates based on the EM algorithm for the shared gamma, inverse gaussian, weighted Lindley, Birnbaum-Saunders, truncated normal, mixture of inverse gaussian and mixture of Birbaum-Saunders frailty models.

Usage

frailty.fit(formula, data, dist.frail="gamma", dist = "np", prec = 1e-04, 
        max.iter = 1000, part=NULL)

Arguments

formula

A formula that contains on the left hand side an object of the type Surv and on the right hand side a +cluster(id) statement, possibly with the covariates definition.

data

A data.frame in which the formula argument can be evaluated

dist.frail

the distribution assumed for the frailty. Supported values: gamma (GA also is valid), IG (inverse gaussian), WL (weighted Lindley), BS (Birnbaum-Saunders), TN (truncated normal), MIG (mixture of IG) and MBS (mixture of BS).

dist

the distribution assumed for the basal model. Supported values: weibull, pe (piecewise exponential), exponential and np (non-parametric).

prec

The convergence tolerance for parameters.

max.iter

The maximum number of iterations.

part

partition time (only for piecewise exponential distribution).

Details

For the weibull, exponential and piecewise exponential distributions as the basal model, the M1-step is performed using the optim function. For the non-parametric case, the M1-step is based on the coxph function from the survival package.

Value

an object of class "extrafrail" is returned. The object returned for this functions is a list containing the following components:

coefficients

A named vector of coefficients

se

A named vector of the standard errors for the estimated coefficients.

t

The vector of times.

delta

The failure indicators.

id

A variable indicating the cluster which belongs each observation.

x

The regressor matrix based on cov.formula (without intercept term).

dist

The distribution assumed for the basal model.

dist.frail

The distribution assumed for the frailty variable.

tau

The Kendall's tau coefficient.

logLik

The log-likelihood function (only when the Weibull model is specified for the basal distribution).

Lambda0

The observed times and the associated cumulative hazard function (only when the non-parametric option is specified for the basal distribution)

part

the partition time (only for piecewise exponential model).

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Gallardo, D.I., Bourguignon, M. (2022) The shared weighted Lindley frailty model for cluster failure time data. Submitted.

Gallardo, D.I., Bourguignon, M., Romeo, J. (2024) Birnbaum-Saunders frailty regression models for clustered survival data. Statistics and Computing, 34, 141.

Examples

require(survival)
#require(frailtyHL)
data(rats, package="frailtyHL")
#Fit for WL frailty model
fit.WL <- frailty.fit(survival::Surv(time, status)~ rx+ survival::cluster(litter), 
dist.frail="WL", data = rats)
summary(fit.WL)
#Fit for gamma frailty model
fit.GA <- frailty.fit(survival::Surv(time, status) ~ rx + survival::cluster(litter), 
dist.frail="gamma", data = rats)
summary(fit.GA)

Generated random variables from the weighted Lindley distribution.

Description

Generated random variables from the weighted Lindley distribution with mean 1.

Usage

rWL(n, theta = 1)

Arguments

n

number of observations. If length(n) > 1, the length is taken to be the number required.

theta

variance of the variable.

Details

The weighted Lindley distribution has probability density function

f(z;θ)=θ2Γ(θ)aθbθ1zbθ1(1+z)exp(zaθ),z,θ>0,f(z;\theta)=\frac{\theta}{2\Gamma(\theta)}a_{\theta}^{-b_{\theta}-1}z^{b_{\theta}-1}(1+z)\exp\left(-\frac{z}{a_{\theta}}\right), \quad z, \theta>0,

where aθ=θ(θ+4)2(θ+2)a_{\theta}=\frac{\theta(\theta+4)}{2(\theta+2)} and bθ=4θ(θ+4)b_{\theta}=\frac{4}{\theta(\theta+4)}. Under this parametrization, E(Z)=1 and Var(Z)=θ\theta.

Value

a vector of length n with the generated values.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Gallardo, D.I., Bourguignon, M. (2022) The multivariate weighted Lindley frailty model for cluster failure time data. Submitted.

Examples

rWL(10, theta=0.5)

Print a summary for a object of the "extrafrail" class.

Description

Summarizes the results for a object of the "extrafrail" class.

Usage

## S3 method for class 'extrafrail'
summary(object, ...)

Arguments

object

an object of the "extrafrail" class.

...

for extra arguments.

Details

Supported frailty models are: - gamma frailty model - inverse gaussian frailty model - weighted frailty model - Birnbaum-Saunders frailty model - Truncated normal frailty model - Mixture of inverse gaussian frailty model - Mixture of Birnbaum-Saunders frailty model

Value

A complete summary for the coefficients extracted from a "extrafrail" object.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Gallardo and Bourguignon (2022).

Examples

#require(frailtyHL)
require(survival)
data(rats, package="frailtyHL")
fit <- frailty.fit(survival::Surv(time, status) ~ rx + survival::cluster(litter), 
dist.frail="WL", data = rats)
summary(fit)