Re: R-beta: a bug in the lm function ?

Thomas Lumley (thomas@biostat.washington.edu)
Fri, 19 Dec 1997 09:44:05 -0800 (PST)


Date: Fri, 19 Dec 1997 09:44:05 -0800 (PST)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: Kung-Sik Chan <kchan@stat.uiowa.edu>
Subject: Re: R-beta: a bug in the lm function ?
In-Reply-To: <Pine.HPP.3.96.971219104401.15470A-100000@piano.stat.uiowa.edu>

On Fri, 19 Dec 1997, Kung-Sik Chan wrote:
> 
> I ran a function called BoxCox, taken from the book by Venables and
> Ripley, for checking the need for power transformation. This function
> works fine using the version 0.50 of R, but gives an error message
> with version 0.60.
> 
> The lm function in version 0.60 is different from that in version 0.50.
> 
> Is there a bug in the new lm function?

> 
> >  BoxCox(lm(log.O2UP~BOD+TKN+TS+TVS+COD,data=alr222a))
> Error in terms.default(formula, data = data) : unused argument to function


No, there is a bug in terms.default(). The generic terms() function
accepts a number of arguments controlling how terms objects are
constructed. As terms.default() just extracts a terms object that is
already present it doesn't use these arguments. However, it hasn't been
written to ignore them.  A fix is to redefine terms.default() to ignore
these arguments

	terms.default<-function (x,...) x$terms

In the future it may be desirable to change terms.default so that it
recomputes the terms object if the other arguments are present, in case
they are different from the original versions.  


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------
	

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._