a question in coxph

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

a question in coxph

Lei Liu-2
Hi there,

I tried to fit a penalized spline for a continuous risk factor in
recurrent events data. I found that I can include both pspline and
frailty terms in coxph. So I use code like

   fit1 <- coxph(Surv(start, end, event)~pspline(age, df=0) + male +
white +frailty(id), data.all)

It yields results for both age spline and frailty variance. Next I
tried to draw the plot for age effect. I used termplot function

   termplot(fit1, terms=c(1), se=TRUE)

However, it gives me some error message:

Error in dimnames(pred) <- list(dimnames(x)[[1]], termname) :
   length of 'dimnames' [2] not equal to array extent

I don't know why. However, if I delete the frailty option, and use only

   fit2 <- coxph(Surv(start, end, event)~pspline(age, df=0) + male +
white, data.all)

I can generate the plot by

termplot(fit2, terms=c(1), se=TRUE)

So it seems to me that adding the frailty() option makes the
"termplot" function fail to work? Do you know how to draw the plot
for my function fit1? Thanks a lot!


At 09:53 AM 7/20/2009, you wrote:
>  I would be willing to chair the session.
>         Terry Therneau

[hidden email] mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.