[R] Bug in predict.lm?
pdalgd at gmail.com
Sat Nov 16 10:35:46 CET 2013
On 16 Nov 2013, at 03:06 , Charles Berry <ccberry at ucsd.edu> wrote:
> Rolf Turner <r.turner <at> auckland.ac.nz> writes:
>> I *do* see the same phenomenon that Bert describes and the code of
>> *does* appear to contain a bug. There is a line:
>> The operative difference between my set-up and Chuck's is that I am using
>> version 3.0.2 Patched. So I am very puzzled as to why Chuck does *not* get
>> an error thrown!
> [rest deleted]
> The answer is that I made a rookie error.
> I ran
> before trying Bert's ECM.
> And then I did not bother to see what example(predict.lm) left lying
> around in R_GlobalEnv ...
> As you can probably guess, there was an object called 'w'.
> So predict.lm finds it and is.null(w) is FALSE.
> Mea culpa!
Hmm, maybe, but this is the sort of thing that code analysis tries to catch (as in "no visible binding for global variable 'w'"). Apparently, the code checker is not smart enough to detect cases where a local variable is _sometimes_ not defined.
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help