Re: [Rd] Possible bug in predict.lm when x is a poly

2021-03-29 Thread Ben Bolker
Any particular reason you're using I() around your poly()? That looks weird to me ... and it works fine if you don't do that ... {AND, I think your result is *incorrect* when you have 3 observations in your response}. Basically, you have managed to short-circuit the (admittedly) obscure

[Rd] Possible bug in predict.lm when x is a poly

2021-03-29 Thread Kenny Bell
Hi all, As always, thank you all for your incredible work maintaining and improving R. mdl <- lm(data = mtcars, mpg ~ I(poly(disp, 2))) predict(mdl, newdata = data.frame(disp = c(120, 120))) #> Error in poly(disp, 2): 'degree' must be less than number of unique points predict(mdl, new