« Return to Thread: predict.glm & newdata

predict.glm & newdata

by Tom Guston :: Rate this Message:

Reply to Author | View in Thread


Hi all -

I'm stumped by the following

mdl <- glm(resp ~ . , data = df, family=binomial, offset = ofst) WORKS
yhat <- predict(mdl) WORKS
yhat <- predict(mdl,newdata = df) FAILS

Error in drop(X[, piv, drop = FALSE] %*% beta[piv]) :
  subscript out of bounds


I've tried without offset, quoting binomial. The offset variable ofst IS in df.

Previous postings indicate possible names(df) problems (renaming factor levels?) but I'm using the same data.frame for the newdata option.

Thank you in advance for any pointers.

Tom.




_________________________________________________________________
Going green? See the top 12 foods to eat organic.

1N1653A
        [[alternative HTML version deleted]]

______________________________________________
R-help@... mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

 « Return to Thread: predict.glm & newdata