# [R] Where is gam?

Simon Wood snw at mcs.st-and.ac.uk
Tue Oct 3 17:54:51 CEST 2000

```
> I noticed that there is no generalised additive model functions in R
> (1.1.1)  ... is there a package that implements them?

I've produced a preliminary version of a package that fits gams
implemented using 1-d penalized regression splines: it includes a version
of gam(). Smoothing parameter selection is done on all terms
simultaneously using GCV. It's available from:

http://www.ruwpa.st-and.ac.uk/simon/mgcv.html

... the plan is to add multidimensional terms fairly soon, and to make it
more widely available after a bit more testing. It's only advantages over
gss is speed on large datasets and the fact that it provides a version of
gam().

I don't know what other people think, but my concerns about gams
relate to the oddness of their structure. Often, modelling amounts to
response i.e. you want to find the f in:

E(y) = f(x_1, x_2, x_3....)

unless there's good prior reason to do so why would you start by letting:

f(.) = f_1(x_1) + f_2 (x_2) + f_3 (x_3) +.... ?

The point is maybe clearest by considering polynomial models. If you don't
know f(.) it seems reasonable to use some taylor expansion of f(.) as a
model... e.g.

f(.) = a + b x_1 + c x_2 + d x_3 + e x_1 x_2 + g x_1 x_3 + h x_2 x_3 +
p x_1^2 + q x_2^2 + r x_3^2 + ...

Using gams is rather like deleting all mixed terms in this expansion
(i.e. e x_1 x_2,  g x_1 x_3 etc). This seems like a very odd thing to do
and gets wierder the more degrees of freedom you allow the model.

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```