Skip to content

GAM plots

2 messages · Joe Trubisz, Simon Wood

#
Hello all...

I'm attempting to write my own GAM plot function, so I can overlay it  
on top of an already existing plot.

Problem is that after I do the gam, e.g. m<-gam(...), I cannot match  
the graph that gam.plot outputs  when I attempt to plot the values  
from m$residuals, m$linear.predictors or m$fitted.values. Kind of at a  
loss what variables to use or if I need to do something else before I  
attempt to plot them.

Can someone explain to me where I'm going wrong and what I need to do  
to correct this?

Thanks,
Joe
5 days later
#
Are you using mgcv:::gam? To get plot data suitable for making plots of smooth 
effects, you probably need to use `predict.gam' to evaluate the smooth curves 
(and standard errors) at a nice regular set of points for plotting. Also 
don't forget that the residuals shown on plot.gam are the `partial residuals' 
(i.e. the residuals + the smooth concerned). 

best,
Simon
On Sunday 22 November 2009 01:09, Joe Trubisz wrote: