Re: [Rd] question about trailing arguments in an S4 method

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 16 Dec 2006 - 20:31:50 GMT

I don't see how this can work, in S3 or S4. Callers of AIC are entitied to expect it to behave as described on the help page, and so to be able to pass objects called (e.g.) 'delta' and get back exactly the value mentioned.

For what you seem to want to do, I think you need your own generic.

On Sat, 16 Dec 2006, Ben Bolker wrote:

>
> I'm trying to add arguments to the AIC method
> for some classes -- things like
> weights=TRUE to calculate AIC weights
> corr=TRUE, nobs to calculate AICc
> delta=TRUE to put a delta-AIC column in the output.
>
> The problem is that AIC is defined as
> AIC(object, ..., k=2) where k is the constant associated
> with the penalty term and ... is a list of objects
> that will have their AICs calculated and listed.
> Thus I'm not allowed (I think) to extend the definition to
>
> AIC(object, ..., nobs, corr=FALSE, delta=FALSE, weights=FALSE, k=2)
>
> An ugly solution to this is to go through the ... list and
> pull out the values of any of the other arguments I want, and
> then set them to NULL, leaving the list composed only of
> additional objects to calculate the AIC for. But it seems
> really ugly ...
>
> Any ideas for a better way to do this would be
> appreciated. (Please be gentle if possible, I'm a bit out
> of my depth with S4 ...)
>
> cheers
> Ben Bolker
>
>
>

-- 
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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun Dec 17 12:35:58 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 17 Dec 2006 - 02:31:00 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.