gam(formula, family = gaussian, data = <<see below>>, weights = <<see below>>, subset = <<see below>>, na.action = na.fail, start = <<see below>>, control = gam.control(...), trace = F, model = F, x = F, y = T, contrasts = NULL, ...)
The response variable must conform with the definition of family, for example factor or binary data if family=binomial is declared.
The model is fit using the local scoring algorithm, which iteratively fits weighted additive models by backfitting. The backfitting algorithm is a Gauss-Seidel method for fitting additive models, by iteratively smoothing partial residuals. The algorithm separates the parametric from the nonparametric part of the fit, and fits the parametric part using weighted linear least squares within the backfitting algorithm.
Although nonparametric smooth terms lo and s can be mixed in a formula, it is faster and less memory intensive to use a single smoothing method for all the smoothing terms in an additive model. In this case the entire local scoring algorithm is performed in Fortran, which, although faster, is not readable or modifiable by the user.
gam(Kyphosis ~ s(Age,4) + Number, family = binomial, data = kyphosis) gam(ozone^(1/3) ~ lo(radiation) + lo(wind, temperature), data = air) gam(Kyphosis ~ poly(Age, 2) + s(Start), data = kyphosis, subset = Number>5)