[R] coxme with frailty--variance of random effect?
Terry Therneau
therneau at mayo.edu
Mon Feb 6 13:56:57 CET 2012
In answer to the several questions:
1. Variance of the random effect: Your example is not reproducable
since you didn't give the random number seed. Instead I'll use one of
the data sets that comes with the survival package.
> library(coxme)
> fit <- coxme(Surv(tstart, tstop, status) ~ treat + (1|center), cgd)
> VarCorr(fit)$center
Intercept
0.1643779
> var(ranef(fit)$center)
Intercept
[1] 0.06261608
Yes, it is true that for a random effects model, the estimated variance
of the random effect is not equal to var(estimated per center effects).
Exactly the same is true of a linear mixed effects model: try the same
with lmer
> library(lme4)
> lfit(status ~ treat + (1|center), cgd)
> VarCorr(lfit)$center
> var(ranef(lfit)$center)
Why? It's a statistical insight that took me a while, so I don't think I
can explain it over email. Find someone familiar with mixed efffects
models and have a chat.
2. coxph(.... +frailty(center)) and coxme give different results.
Read the documentation. One of them is fitting a gamma distribution
for the random effect, the other a Gaussian.
Terry Therneau
More information about the R-help
mailing list