[R] extractAIC.survreg problem with df
Prof Brian Ripley
ripley at stats.ox.ac.uk
Wed Apr 21 19:12:33 CEST 2004
A few more comments:
1) fit$residuals is a *component* of a list, not an attribute.
2) Since n is evaluated as zero, this only affects the constant in AIC
and model selection was unaffected.
3) fit$df is a vector, and you want sum(fit$df).
I've updated the code in R-patched.
On Wed, 21 Apr 2004, Prof Brian Ripley wrote:
> There has been a change in the survreg function since that was written
> ....
>
> On Wed, 21 Apr 2004, Stefano Calza wrote:
>
> > Hi everybody.
> >
> > I'm having problems with the extractAIC.survreg function and the edf
> >
> > I get weird results which I think are due to the fact that the function defines edf as (from the stats package in 1.9.0 source code)
> >
> > ...
> > ...
> > n <- length(fit$residuals)
> > edf <- n-fit$df.residual
> > ...
> >
> > But in a survreg object there's no attribute residuals!!??
> >
> > if in the function I use instead
> >
> > ...
> > n <- length(residuals(fit)
> > ...
> >
> > everything's fine, or better
> >
> > ...
> > edf <- fit$df
> > ...
> >
> > Am I missing something?
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list