Skip to content
Prev 106648 / 398525 Next

Question about predict function

Thomas L Jones wrote:
Does this help?

library(gam)
data(kyphosis)

kyphosis.gam <- gam(Kyphosis ~ s(Age,4) + Number, family = binomial,
data=kyphosis)

predict(kyphosis.gam, data.frame(Age = c(10,100,200), Number = 3),
type="response")

          1           2           3
0.019098701 0.248043366 0.005807921

  The data frame should contain the predictor variables in the model and
the values for the variables should be those at which you want a prediction.