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?
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:
> fitf2$coef
age log(bili) log(protime) log(albumin) edema gamma:1
0.05413962 1.11244236 2.64338176 -3.89824452 0.71347526 0.15547991
gamma:2 gamma:3 gamma:4
0.25794637 -0.47470789 -0.08834457
And a $means objects with 9 elements:
> fitf2$means
[1] 49.25963095 0.60313783 2.39101856 1.20878208 0.18226221 0.39845758
[7] 0.33727506 0.23804627 0.02622108
What do the means fitf2$means[6:9] correspond to?
I am asking these questions because I would like to clarify how the
frailty terms enter into the computation of the baseline cumulative hazard
via the basehaz(fitf, centered=FALSE) function. It would seem that the way
the basehaz function operates is different dependening upon how many
frailty groups there are.
Thank you very much for your help.
giacomo
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