Thanks to Terry Therneau for a rapid and effective solution to the problem
of computing a dfbeta residual. He notes that the problem probably results
from an error when the residual function tries to reconstruct the design
matrix for the model. This problem can be avoided if one includes an
"x=TRUE" argument to the coxph function call:
coxph(formula = Surv(start, stop, event) ~ C(trt, plac.ref) +
not.first + cluster(pid), data = chfc.wei, x=TRUE)
This causes the coxph function to store a copy of the design matrix (as "x")
in the model object. The residuals.coxph function then computes the dfbeta
residuals correctly.
Thanks again, Terry.
Larry Hunsicker
> -----Original Message-----
> From: Hunsicker, Lawrence
> Sent: Wednesday, August 28, 2002 4:41 PM
> To: 's-news@lists.biostat.wustl.edu'
> Subject: [S] problem computing dfbeta by residuals.coxph in model
> with a cluster term
>
> Hi, all:
>
> I'm back to the trough with a very specific problem. I should like to
> examine the dfbeta residuals of a multiple-event cox model that includes a
> cluster term. One of the covariates in the del is "not.first". The
> model specification is:
>
> coxph(formula = Surv(start, stop, event) ~ C(trt, plac.ref) +
> not.first + cluster(pid), data = chfc.wei)
>
> When I run the following:
>
> dfb<-residuals.coxph(chfc.fit1,type='dfbeta')
>
> I get the following error message:
>
> Problem in model.frame.coxph(fit): Length of not.first (variable 3)
> is 1
> != length of others (2030)
>
> If I delete the 'not.first' covariate, the function works fine. I should
> like to include the not.first, as it turns out to be an important
> explanatory variable. Am I doing something wrong, or is there a glitch in
> the program?
>
> Larry Hunsicker
>
>
>
|