Skip to content
Prev 206511 / 398506 Next

predict.glm

Maurice,

The 'newdata' argument should be a data.frame with the
same names as used for your predictors in the glm formula.

For the data you quote below (after fixing the missing y1),
try:

yhat <- predict(reg1, newdata = data.frame(x1 = x2))
length(yhat)
[1] 200

A careful reading of ?predict would have told you that:

"newdata    optionally, a data frame in which to look for
             variables with which to predict."

If that is not your problem, perhaps you could give an
example with data and code that illustrates your problem.

  -Peter Ehlers
Maurice Charbit wrote: