[R] GAM plots

Simon Wood s.wood at bath.ac.uk
Fri Nov 27 12:07:14 CET 2009


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:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283




More information about the R-help mailing list