[S] predicted values from gam() w/o data= argument

Hong Ooi (hong@zip.com.au)
Tue, 18 Aug 1998 13:00:49 GMT

Hello all,

This is probably a really simple question but I can't find the answer
anywhere. I've got a logistic regression model which I fitted using
gam() as follows--

cust.gam <- gam(cust.y ~ s(cust.x[,1]) + s(cust.x[,2]) + s(cust.x[,3]) +
s(cust.x[,4]) + s(cust.x[,5]), family=binomial)

where cust.y and cust.x are separate matrices (not data frames) in my
working directory. AFAIK, this works fine and generates a gam object
without any problems.

I now want to get predicted values from this model for a new set of
predictors, call it cust.xnew. cust.xnew is a matrix with the same
number of columns as cust.x. But when I try something like
predict(cust.gam, newdata=cust.xnew), it crashes horribly. I've also
tried various combinations like

predict(cust.gam, newdata=as.matrix(cust.xnew)) and

predict(cust.gam, newdata=as.data.frame(cust.xnew))

etc, but nothing works.

I realise that I could just combine the cust.x and cust.y matrices into
one data frame and refit, but is there a simple way to get predicted
values from the model I've got already?

I'm using Splus 4.0 release 1, on a Pentium II running Win NT 4.0.


Hong Ooi            | NRMA Research and Development
hong@zip.com.au     | Ph:  02-9292-1532
Sydney, Australia   | Fax: 02-9292-1509
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news