Learn R Programming

stdReg (version 3.4.1)

parfrailty: Fits shared frailty gamma-Weibull models

Description

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

Usage

parfrailty(formula, data, clusterid, init)

Arguments

formula

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

data

a data frame containing the variables in the model.

clusterid

an string containing the name of a cluster identification variable.

init

an optional vector of initial values for the model parameters.

Value

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

est

the 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.

Details

parfrailty fits the shared frailty gamma-Weibull model $$\lambda(t_{ij}|C_{ij})=\lambda(t_{ij};\alpha,\eta)U_iexp\{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, parametrized 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., Sjolander 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
# NOT RUN {
# }
# NOT RUN {
require(survival)

#simulate data
n <- 1000
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)
#reparametrize 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(summary(fit))

# }
# NOT RUN {
# }

Run the code above in your browser using DataLab