[R] coxph and frailty

Thomas Lumley tlumley at u.washington.edu
Mon Aug 4 23:39:52 CEST 2003


yOn Mon, 4 Aug 2003 gc4 at duke.edu wrote:

> Hi:
>
> I have a few clarification questions about the elements returned by
> the coxph function used in conjuction with a frailty term.
>
> I create the following group variable:
>
> group <- NULL
> group[id<50] <- 1
> group[id>=50 & id<100] <- 2
> group[id>=100 & id<150] <- 3
> group[id>=150 & id<200] <- 4
> group[id>=200 & id<250] <- 5
> group[id>=250 & id<300] <- 6
> group[id>=300] <- 7
>
> I estimate the following model, using the Pbc data (with time-varying
> covariates) from Therneau and Grambsch's book:
>
>
> fitf <- coxph(Surv(start,stop,event==2) ~ age + log(bili) + log(protime) +
>                          log(albumin) + edema + frailty(group),
>                          na.action=na.exclude, data=Pbcseq)
>
>
> Then I obtain:
>
> > fitf[10]
> $frail
> [1]  0.06273372  0.16192093  0.10050877  0.37716999 -0.20853156 -0.71887977
> [7] -0.10922275
>
> And:
>
> > fitf[11]
> $fvar
> [1] 0.03631634 0.03261972 0.03750465 0.04459689 0.05113802 0.08107876 0.11482236
>
> My understanding is that fitf$frail are the group level frailty terms. But
> what is fitf$fvar?

The inverse of the diagonal of the second derivative of the penalised
loglikelihood.  By default a diagonal approximation to the second
derivative is used when there are more than five groups (there's an
argument to frailty() to control this).


>
> Moreover, if I estimate the same model as the one above, but with a
> `group' variable with only 4 groups (instead of 7 as in the example
> above), the coxph object does not contain those two elements.
>
> Instead, it reports a $coef object that includes the frailty terms:

Yes, with 5 or fewer terms it doesn't use the sparse algorithm, but
treats them as coefficients in the usual way.

	-thomas


Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list