Learn R Programming

stdReg2 (version 1.0.3)

parfrailty: Fits shared frailty gamma-Weibull models

Description

parfrailty fits shared frailty gamma-Weibull models. It is specifically designed to work with the function standardize_parfrailty, which performs regression standardization in shared frailty gamma-Weibull models.

Usage

parfrailty(formula, data, clusterid, init)

Value

An object of class "parfrailty" which is a list containing:

est

the Maximum Likelihood (ML) estimates \(\{\log(\hat{\alpha}),\log(\hat{\eta}), \log(\hat{\phi}),\hat{\beta}\}\).

vcov

the variance-covariance vector of the ML estimates.

score

a matrix containing the cluster-specific contributions to the ML score equations.

Arguments

formula

an object of class "formula", in the same format as accepted by the coxph function.

data

a data frame containing the variables in the model.

clusterid

a string containing the name of a cluster identification variable.

init

an optional vector of initial values for the model parameters.

Author

Arvid Sjölander and Elisabeth Dahlqwist.

Details

parfrailty fits the shared frailty gamma-Weibull model $$\lambda(t_{ij}|C_{ij})=\lambda(t_{ij};\alpha,\eta)U_i\exp\{h(C_{ij};\beta)\},$$ where \(t_{ij}\) and \(C_{ij}\) are the survival time and covariate vector for subject \(j\) in cluster \(i\), respectively. \(\lambda(t;\alpha,\eta)\) is the Weibull baseline hazard function $$\eta t^{\eta-1}\alpha^{-\eta},$$ where \(\eta\) is the shape parameter and \(\alpha\) is the scale parameter. \(U_i\) is the unobserved frailty term for cluster \(i\), which is assumed to have a gamma distribution with scale = 1/shape = \(\phi\). \(h(X;\beta)\) is the regression function as specified by the formula argument, parameterized by a vector \(\beta\). The ML estimates \(\{\log(\hat{\alpha}),\log(\hat{\eta}),\log(\hat{\phi}),\hat{\beta}\}\) are obtained by maximizing the marginal (over \(U\)) likelihood.

References

Dahlqwist E., Pawitan Y., Sjölander A. (2019). Regression standardization and attributable fraction estimation with between-within frailty models for clustered survival data. Statistical Methods in Medical Research 28(2), 462-485.

Van den Berg G.J., Drepper B. (2016). Inference for shared frailty survival models with left-truncated data. Econometric Reviews, 35(6), 1075-1098.

Examples

Run this code


require(survival)

# simulate data
set.seed(5)
n <- 200
m <- 3
alpha <- 1.5
eta <- 1
phi <- 0.5
beta <- 1
id <- rep(1:n, each = m)
U <- rep(rgamma(n, shape = 1 / phi, scale = phi), each = m)
X <- rnorm(n * m)
# reparameterize scale as in rweibull function
weibull.scale <- alpha / (U * exp(beta * X))^(1 / eta)
T <- rweibull(n * m, shape = eta, scale = weibull.scale)

# right censoring
C <- runif(n * m, 0, 10)
D <- as.numeric(T < C)
T <- pmin(T, C)

# strong left-truncation
L <- runif(n * m, 0, 2)
incl <- T > L
incl <- ave(x = incl, id, FUN = sum) == m
dd <- data.frame(L, T, D, X, id)
dd <- dd[incl, ]

fit <- parfrailty(formula = Surv(L, T, D) ~ X, data = dd, clusterid = "id")
print(fit)

Run the code above in your browser using DataLab