[R] Extracting the results of a gam smooth

Thomas L Jones DrJones at alum.MIT.edu
Sat Apr 15 08:56:07 CEST 2006

I am conducting a gam smooth and having a devil of a time getting out 
the answers so I can work with them.

Here are the two lines of code:

> model <- gam(y~lo(x, span=0.75, degree=2), family=poisson)
> resp_pout <- predict (model, data.frame (x=x), type = 'response')

The problem comes when I try to get the answers out. I cannot for the 
life of me figure out the format of resp_pout, and I have been trying 
literally for WEEKS to get the answer. Surely this is a perfectly 
standard question which has been asked and answered dozens of times. 
Let's see if I can rephrase the question.

There are 118 response points generated by the smoothing operation. I 
need a function f such that v <- f(resp_pout) is a vector with 118 
components comprising the 118 response points. Would some kind soul 
provide it? Or is my entire research effort going to be BLOWN UP 
because I can't figure out how to do this?

Thomas Jones

More information about the R-help mailing list