[R] plotting gam models
s.wood at bath.ac.uk
Tue Jul 24 14:02:18 CEST 2007
> Thank you for your suggestion.
> Actually, I have already tried it, but I am confused because the plot I get
> is not the same as the output of plot(model) or plot.gam(model). The yaxis
> is different
-- `plot.gam' will always plot the `centered smooth', i.e. the smooth
constrained to sum to zero over the data. By default (i.e. using type="link")
`predict.gam' will include the intercept in the predctions. If you want
centered terms out of `predict.gam' use the `type="terms" option.
> On the other hand, if I build a more complex model, as for example:
> model<- gam(x ~ s(lat,long) + s(temperature))
> I would like to extract the information to build the effects for each
> explanatory factor (one graph for s(lat,long) and another for
> s(temperature)), as R does when you use 'plot(model)' and you press return
> for subsequent pages.
Again, try predict.gam with type="terms"
> 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