[R] More questions about gam and plot

Simon Wood simon at stats.gla.ac.uk
Tue Jul 15 12:12:14 CEST 2003

> When I use a "gam" command
> c <- gam(depvar~var1+var2+s(var3)+s(var4)........)
> Followed by a plot command
> plot(c,....)   
> The standard errors cross in the middle of the graph, (This variable is
> almost linearly related with the outcome variable) why?

- Smooth terms are "centred" - which means that they are constrained to
sum to zero over the covariate values. For a straight line this means that
there must be one point that is "known" exactly. 

> When I use the "persp" command after the gam fit, it does not graph the
> smooth terms but usually two of the other terms in the model, why?

- By default, persp picks up the first two covariates in your model. If
you want to plot against other variables you need to tell persp this...
see ?persp.gam.


> Simon Wood simon at stats.gla.ac.uk        www.stats.gla.ac.uk/~simon/
>>  Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>>   Direct telephone: (0)141 330 4530          Fax: (0)141 330 4814

More information about the R-help mailing list