coxme {coxme}R Documentation

Fit a mixed effects Cox model


Fit a Cox model containing mixed (random and fixed) effects. Assume a Gaussian distribution for the random effects.


coxme(formula, data, weights, subset, na.action, init, control,
ties = c("efron", "breslow"),
varlist, vfixed, vinit,  x = FALSE, y = TRUE,
refine.n = 0, random, fixed, variance, ...)



a two-sided formula with a survival object as the left hand side of a ~ operator and the fixed and random effects on the right.


an optional data frame containing the variables named in the formula.

subset, weights, na.action

further model specifications arguments as in lm; see there for details.


optional initial values for the fixed effects.


optional list of control options. See coxme.control for details.


method for handling exact ties in the survival time.


the variance family to be used for each random term. If there are multiple terms it will be a list of variance functions. The default is coxmeFull. Alternatively it can be a list of matrices, in which case the coxmeMlist function is used.


optional named list or vector used to fix the value of one or more of the variance terms at a constant.


optional named list or vector giving suggested starting values for the variance.


if TRUE the X matrix (fixed effects) is included in the output object


if TRUE the y variable (survival time) is included in the output object


number of samples to be used in a monte-carlo estimate of possible error in the log-likelihood of the fitted model due to inadequacy of the Laplace approximation.

fixed, random, variance

In the preliminary version of coxme the fixed and random effects were separate arguments. These arguments are included for backwards compatability, but are depreciated. The variance argument is a depreciated alias for vfixed.


any other arguments are passed forward to coxme.control.


An object of class coxme.


Terry Therneau


S Ripatti and J Palmgren, Estimation of multivariate frailty models using penalized partial likelihood, Biometrics, 56:1016-1022, 2000.

T Therneau, P Grambsch and VS Pankratz, Penalized survival models and frailty, J Computational and Graphical Statistics, 12:156-175, 2003.

See Also

coxmeFull, coxmeMlist, coxme.object


# A non-significant institution effect
fit1 <- coxph(Surv(time, status) ~ ph.ecog + age, data=lung,
fit2 <- coxme(Surv(time, status) ~ ph.ecog + age + (1|inst), lung)
anova(fit1, fit2)

# Shrinkage effects (equivalent to ridge regression)
temp <- with(lung, scale(cbind(age, wt.loss,
rfit <- coxme(Surv(time, status) ~ ph.ecog + (temp | 1), data=lung)

[Package coxme version 2.2-20 Index]