From ripley at stats.ox.ac.uk  Mon May 24 08:24:51 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon May 24 08:25:02 2004
Subject: [Rd] bug in extractAIC.survreg (PR#6910)
In-Reply-To: <20040524030121.E94B410559@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.44.0405240718220.14723-100000@gannet.stats>

The currrent version of R is 1.9.0, and that has public patches which say
(in the NEWS file)

    o	extractAIC.survreg() needed updating.

The R posting guide does ask you to check the latest version before 
wasting people's time.

It is a double waste of time to send this twice (as 6909 as well): please 
do read the description of how to add to a previous report.


On Mon, 24 May 2004 ramseyd@landcareresearch.co.nz wrote:

> Full_Name: Dave Ramsey
> Version: 1.8.0
> OS: win2000
> Submission from: (NULL) (202.27.240.6)
> 
> 
> there is a bug in extractAIC.survreg in library MASS.

extractAIC.survreg is not in *package* MASS:

> getAnywhere("extractAIC.survreg")
A single object matching 'extractAIC.survreg' was found
It was found in the following places
  registered S3 method for extractAIC from namespace stats
  namespace:stats
with value

function (fit, scale, k = 2, ...)
{
    edf <- sum(fit$df)
    c(edf, -2 * fit$loglik[2] + k * edf)
}
<environment: namespace:stats>

Had you thought so, you should have communicated with the package 
maintainer (and told him the package version).


> A survreg model object has no component called "residuals".  Hence  
> 
> n <- length(fit$residuals)
> 
> returns 0 resulting in errors 
> 
> workaround:   replace 
> 
> n <- length(fit$residuals)
> 
> with
> 
> n <- length(residuals(fit))
> 
> ### sorry: error in my email address on previous posting
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
Brian D. Ripley,                  ripley@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


[Rd] bug in extractAIC.survreg (PR#6910)
Prof Brian Ripley