MASS:::dropterm.glm() and MASS:::addterm.glm() should use ... for extractAIC()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MASS:::dropterm.glm() and MASS:::addterm.glm() should use ... for extractAIC()

R devel mailing list
Here is a change required from MASS:::dropterm.glm() and
MASS:::addterm.glm().

Thanks

Marc


The stepAIC() function from package MASS uses extractAIC() to get the
AIC from a model.
Several methods exist:
extractAIC.glm() for example, some in MASS packages and some in stats
package.

The parameters for extractAIC() are:
fit, scale, k = 2, ...

The ... are not used in most of the extractAIC.xxx() methods, from
example in stats:::extractAIC.glm() or MASS:::extractAIC.loglm() but its
presence could be necessary if extractAIC() is changed to use for
example to use AICc rather than AIC.

Within stepAIC(), extractAIC() uses always the ... parameter. So all is
ok for that.

However, stepAIC() uses dropterm() or addterm().

Within MASS:::dropterm.glm() and MASS:::addterm.glm(), extractAIC() is
also used but without the ... parameter.

It prevents to use new version of extractAIC() that could use this
parameter.

The solution is simple:
In MASS:::dropterm.glm(), line 60 and MASS:::addterm.glm(), line 84:
aic <- aic + (extractAIC(object, k = k)[2L] - aic[1L])
must be changed to
aic <- aic + (extractAIC(object, k = k, ...)[2L] - aic[1L])

Other dropterm.xxx() and addterm.xxx() do not suffer this problem.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Loading...