[R] Parametric effects in GAM

Petar Milin pmilin at ff.uns.ac.rs
Wed Oct 3 16:03:48 CEST 2012


On Wed, 2012-10-03 at 12:09 +0100, Simon Wood wrote:
> If b is a fitted gam object...
>    plot(b,all.terms=TRUE)
> --- see ?plot.gam
Many thanks for your answer! But the problem is not as simple. My model
has one te(), and two parametric interactions: two numeric variables
whose effects are changing in two conditions -- of the categorical
factor with two levels. (I tried s(numericA, by=factorA) with them, but
that is just an overfitting, since curves are actually lines, and
anova() between the simpler and more complex model does not support the
later.) Also, the model has a random effect.
Thus, my problem is that plot.gam() does not support this interaction,
i.e., all.terms=TRUE is not handling it, but only the 1st order terms.
So, I was thinking that I could build a gam-model without one
numericA:factorA interaction, and than take gam's residuals to build
simple lm() and to plot that particular effect. Then, the same for the
second interaction numericB:factorA. Unfortunately, I am not sure that
my thoughts would pass sanity check.
Can you comment, please?

Many thanks again! Best,
Petar

> On 02/10/12 20:36, Petar Milin wrote:
> > Hello!
> > Can anyone give a tip how to plot parametric effects in an Generalized
> > Additive Model, from mgcv package?
> >
> > Thanks,
> > PM




More information about the R-help mailing list