[R] Almost a GAM?

vito muggeo vito.muggeo at giustizia.it
Tue Jan 29 09:40:13 CET 2002


Hi all,

> > I would like to estimate, for lack of a better description,
> > a partially additive non-parametric model with the following
> > structure:
> >
> > z~ f(x,y):w1 + g(x,y):w2 + e
> >
> > In other words, I'd like to estimate the marginals with
> > respect to w1 and w2 as nonparametric functions of
> > x and y.

This model should be a "univariate version" to fit interaction between a
variate, x and a factor w, say:
z~ f(x, df1):w1 + g(x, df2):w2 + e
To fit this model a possible solution is

1)build the variate x in each level of w
xw1<-x*w1
xw2<-x*w2

2)then fit gam, by:
z~ w1+w2-1+f(xw1, df1)+ g(xw2, df2)

I am not able to find any theoretical difficulty in this model and
furthermore it seems to work with gam().
However recent works by M.P. Wand et al. use mixed models (GLMM) to fit
additive models with interactions between a smooth variate and factor.
(Actually I don't remember exactly the references but if you want I can look
for it). Although understanding the connections between GAMs and GLMMs may
be not difficult, I really don't understand why I have to fit GLMMs to model
interactions in GAMs.
Any comment is coming?
regards,
vito

PS (for Michael): If I remember well, the S-Plus gam() function never
handled interactions "s(x):w". Just it fitted the linear term "x:w"


----- Original Message -----
From: "Simon Wood" <snw at mcs.st-and.ac.uk>
To: "Michael Roberts" <mroberts at ers.usda.gov>
Cc: <r-help at stat.math.ethz.ch>
Sent: Monday, January 28, 2002 7:34 PM
Subject: Re: [R] Almost a GAM?


> I don't know of a package that will do this easily, sorry! It's on the
> mgcv "to do" list, but involves a fair bit of work. In principle you can
> do it yourself by manipulating the design matrix G$X that you'd get by
> calling
> G<-gam.setup(z~s(x,y)+s(x,y))
> G<-GAMsetup(G)
> .. you just need to multiply the columns of the design matrix relating to
> the first smooth by w1 and the columns relating to the second by w2, then
> gam.fit() can do the rest... the easiest way to do this would be to modify
> gam() [just after GAMsetup() is called].... but obviously this is a
> nuisance (and will hopefully not be necessary in mgcv 0.8!)
>
> > I would like to estimate, for lack of a better description,
> > a partially additive non-parametric model with the following
> > structure:
> >
> > z~ f(x,y):w1 + g(x,y):w2 + e
> >
> > In other words, I'd like to estimate the marginals with
> > respect to w1 and w2 as nonparametric functions of
> > x and y.
> >
> > I'm not positive, but I think I recall being able to estimate
> > a model like this using Splus gam function a couple years
> > ago (I no longer have Splus).  Although, I can
> > see that this would be a bit more difficult to do than a standard
> > gam with univariate partials and no interaction terms. The mgcv
> > gam function doesn't seem to like a function of this form.
>
> Simon
>   ______________________________________________________________________
> > Simon Wood  snw at st-and.ac.uk  http://www.ruwpa.st-and.ac.uk/simon.html
> > The Mathematical Institute, North Haugh, St. Andrews, Fife KY16 9SS UK
> > Direct telephone: (0)1334 463799          Indirect fax: (0)1334 463748
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list