vgam(formula, family, data = list(), weights = NULL, subset = NULL, 
     na.action = na.fail, etastart = NULL, mustart = NULL, 
     coefstart = NULL, control = vgam.control(...), offset = NULL, 
     method = "vgam.fit", model = FALSE, x.arg = TRUE, y.arg = TRUE, 
     contrasts = NULL, constraints = NULL, 
     extra = list(), qr.arg = FALSE, smart = TRUE, ...)"vglmff" (see vglmff-class)
  describing what statistical model is to be fitted. This is called a
  ``environment(formula), typically the environment from which
  vgam is called.weights is a matrix, then it must be in
  matrix-band form, whereby the first $M$ 
  columns of the matrix are the
  diagonals, followed by theNAs.
  The default is set by the na.action setting
  of options, and is na.fail if that is unvgam.control for details.vgam.fit
  uses iteratively reweighted least squares (IRLS).model slot.x and y slots.  Note the model matrix is the LM model
  matrix; to get the VGAM model matrix contrasts.arg of
  model.matrix.default.qr, which returns
  the QR decomposition of the VLM model matrix, is returned on the object.smartpred) will be used.vgam.control."vgam"
  (see vgam-class for further information).vglm.  Vector (cubic smoothing spline) smoothers are represented
  by s() (see s).
  Local regression via lo() is not
  supported. The results of vgam will differ from the S-PLUS and Rgam function (in the vgam
  uses a different knot selection algorithm. In general, fewer knots
  are chosen because the computation becomes expensive when the number
  of additive predictors $M$ is large.
  The underlying algorithm of VGAMs is iteratively
  reweighted least squares (IRLS) and modified vector backfitting
  using vector splines. B-splines are used as the basis functions
  for the vector (smoothing) splines. 
  vgam.fit is the function that actually does the work.
  The smoothing code is based on F. O'Sullivan's BART code.
  A closely related methodology based on VGAMs called
  constrained additive ordination (CAO)
  first forms a linear combination of the explanatory variables 
  (called latent variables) and then fits a GAM to these.
  This is implemented in the function cao for a very
  limited choice of family functions.
  Documentation accompanying the 
vgam.control,
vgam-class,
vglmff-class,
plotvgam,
vglm,
s,
vsmooth.spline,
cao.# Nonparametric proportional odds model 
data(pneumo)
pneumo = transform(pneumo, let=log(exposure.time))
vgam(cbind(normal,mild,severe) ~ s(let), cumulative(par=TRUE), pneumo)
# Nonparametric logistic regression 
data(hunua) 
fit = vgam(agaaus ~ s(altitude, df=2), binomialff, hunua)
plot(fit, se=TRUE)
# Fit two species simultaneously 
fit2 = vgam(cbind(agaaus, kniexc) ~ s(altitude, df=c(2,3)),
            binomialff(mv=TRUE), hunua)
coef(fit2, mat=TRUE)   # Not really interpretable 
plot(fit2, se=TRUE, overlay=TRUE, lcol=1:2, scol=1:2)
attach(hunua)
o = order(altitude)
matplot(altitude[o], fitted(fit2)[o,], type="l", lwd=2, las=1,
    xlab="Altitude (m)", ylab="Probability of presence",
    main="Two plant species' response curves", ylim=c(0,.8))
rug(altitude)
detach(hunua)Run the code above in your browser using DataLab