Bug 15564 - predict.lm throws an error when called with int="conf" and scale =something arguments
predict.lm throws an error when called with int="conf" and scale =something a...
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Models
R 3.0.2
All Windows 32-bit
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-16 00:31 UTC by Bert
Modified: 2013-12-04 10:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bert 2013-11-16 00:31:09 UTC
An example should suffice:

     z <- lm(rnorm(10)~I(1:10))


    predict(z,int="conf",scale=1)

Error in predict.lm(z, int = "conf", scale = 1) : object 'w' not found
Comment 1 Peter Dalgaard 2013-11-16 09:05:42 UTC
Yes. The trip-up is that we do is.null(w), but w is obtained from the computation of res.var which is bypassed if scale is specified. 

I suppose the defensive change would be to replace

else scale^2

with 

else {w <- object$weights ; scale^2}
Comment 2 Brian Ripley 2013-12-04 10:35:03 UTC
Fixed in 3.0.2 patched.