[R-pkgs] gam --- a new contributed package

Trevor Hastie hastie at stanford.edu
Fri Aug 6 19:35:36 CEST 2004

I have contributed a "gam" library to CRAN,
which implements "Generalized Additive Models".

This implementation follows closely the description in 
the GAM chapter 7 of the "white" book "Statistical Models in S"
(Chambers & Hastie (eds), 1992, Wadsworth), as well as the philosophy
in "Generalized Additive Models" (Hastie & Tibshirani 1990, Chapman and
Hall). Hence it behaves pretty much like the Splus version of GAM.

Note: this gam library and functions therein are different from the
gam function in package mgcv, and both libraries should not be used

The gam library allows both local regression (loess) and smoothing
spline smoothers, and uses backfitting and local scoring to fit gams.
It also allows users to supply their own smoothing methods which can
then be included in gam fits.

The gam function in mgcv uses only smoothing spline smoothers, with a
focus on automatic parameter selection via gcv. 

Some of the features of the gam library:

* full compatibility with the R functions glm and lm - a fitted gam
  inherits from class "glm" and "lm"

* print, summary, anova, predict and plot methods are provided, as
  well as the usual extractor methods like coefficients, residuals etc

* the method step.gam provides a flexible and customizable approach to
  model selection. 

Some differences with the Splus version of gam:

* predictions with new data are improved, without need for the
  "safe.predict.gam" function. This was partly facilitated by
  the improved prediction strategy used in R for GLMs and LMs

* Currently the only backfitting algorithm is all.wam. In the earlier
  versions of gam, dedicated fortran routines fit models that had only
  smoothing spline terms (s.wam) or all local regression terms
  (lo.wam), which in fact made calls back to Splus to update the
  working response and weights. These were designed for efficiency. It
  seems now with much faster computers this efficiency is no longer
  needed, and all.wam is modular and "visible"

This package is numbered 0.9 in anticipation of a few bug fixes and
glitches. I have tested many aspects of the functions, but there are
always a few that slip by. I will be happy to hear of any problems,
bugs and suggestions.

Plans for future versions:

* exact standard error calculations. gam employs approximations as
  described in the white book. With a bit more computing (now
  possible), we will have a function that computes exact standard
  errors along the lines described in the GAM book page 127. 

Trevor Hastie

  Trevor Hastie                                  hastie at stanford.edu  
  Professor, Department of Statistics, Stanford University
  Phone: (650) 725-2231 (Statistics)          Fax: (650) 725-8977  
  (650) 498-5233 (Biostatistics)   Fax: (650) 725-6951
  URL: http://www-stat.stanford.edu/~hastie  
  address: room 104, Department of Statistics, Sequoia Hall
           390 Serra Mall, Stanford University, CA 94305-4065

More information about the R-packages mailing list