mgcv (version 1.7-23)

gamObject: Fitted gam object

Description

A fitted GAM object returned by function gam and of class "gam" inheriting from classes "glm" and "lm". Method functions anova, logLik, influence, plot, predict, print, residuals and summary exist for this class.

All compulsory elements of "glm" and "lm" objects are present, but the fitting method for a GAM is different to a linear model or GLM, so that the elements relating to the QR decomposition of the model matrix are absent.

Arguments

Value

  • A gam object has the following elements:
  • aicAIC of the fitted model: bear in mind that the degrees of freedom used to calculate this are the effective degrees of freedom of the model, and the likelihood is evaluated at the maximum of the penalized likelihood in most cases, not at the MLE.
  • assignArray whose elements indicate which model term (listed in pterms) each parameter relates to: applies only to non-smooth terms.
  • boundarydid parameters end up at boundary of parameter space?
  • callthe matched call (allows update to be used with gam objects, for example).
  • cmXcolumn means of the model matrix (with elements corresponding to smooths set to zero ) --- useful for componentwise CI calculation.
  • coefficientsthe coefficients of the fitted model. Parametric coefficients are first, followed by coefficients for each spline term in turn.
  • controlthe gam control list used in the fit.
  • convergedindicates whether or not the iterative fitting method converged.
  • datathe original supplied data argument (for class "glm" compatibility). Only included if gam control argument element keepData is set to TRUE (default is FALSE).
  • deviancemodel deviance (not penalized deviance).
  • df.nullnull degrees of freedom.
  • df.residualeffective residual degrees of freedom of the model.
  • edfestimated degrees of freedom for each model parameter. Penalization means that many of these are less than 1.
  • edf1similar, but using alternative estimate of EDF. Useful for testing.
  • familyfamily object specifying distribution and link used.
  • fitted.valuesfitted model predictions of expected value for each datum.
  • formulathe model formula.
  • full.spfull array of smoothing parameters multiplying penalties (excluding any contribution from min.sp argument to gam). May be larger than sp if some terms share smoothing parameters, and/or some smoothing parameter values were supplied in the sp argument of gam.
  • FDegrees of freedom matrix. This may be removed at some point, and should probably not be used.
  • gcv.ubreThe minimized smoothing parameter selection score: GCV, UBRE(AIC), GACV, negative log marginal likelihood or negative log restricted likelihood.
  • hatarray of elements from the leading diagonal of the `hat' (or `influence') matrix. Same length as response data vector.
  • iternumber of iterations of P-IRLS taken to get convergence.
  • linear.predictorsfitted model prediction of link function of expected value for each datum.
  • methodOne of "GCV" or "UBRE", "REML", "P-REML", "ML", "P-ML", "PQL", "lme.ML" or "lme.REML", depending on the fitting criterion used.
  • mgcv.convA list of convergence diagnostics relating to the "magic" parts of smoothing parameter estimation - this will not be very meaningful for pure "outer" estimation of smoothing parameters. The items are: full.rank, The apparent rank of the problem given the model matrix and constraints; rank, The numerical rank of the problem; fully.converged, TRUE is multiple GCV/UBRE converged by meeting convergence criteria and FALSE if method stopped with a steepest descent step failure; hess.pos.defWas the hessian of the GCV/UBRE score positive definite at smoothing parameter estimation convergence?; iter How many iterations were required to find the smoothing parameters? score.calls, and how many times did the GCV/UBRE score have to be evaluated?; rms.grad, root mean square of the gradient of the GCV/UBRE score at convergence.
  • min.edfMinimum possible degrees of freedom for whole model.
  • modelmodel frame containing all variables needed in original model fit.
  • na.actionThe na.action used in fitting.
  • nsdfnumber of parametric, non-smooth, model terms including the intercept.
  • null.deviancedeviance for single parameter model.
  • offsetmodel offset.
  • optimizeroptimizer argument to gam, or "magic" if it's a pure additive model.
  • outer.infoIf `outer' iteration has been used to fit the model (see gam argument optimizer) then this is present and contains whatever was returned by the optimization routine used (currently nlm or optim).
  • paraPenIf the paraPen argument to gam was used then this provides information on the parametric penalties. NULL otherwise.
  • prior.weightsprior weights on observations.
  • ptermsterms object for strictly parametric part of model.
  • RFactor R from QR decomposition of weighted model matrix, unpivoted to be in same column order as model matrix (so need not be upper triangular).
  • rankapparent rank of fitted model.
  • reml.scaleThe scale (RE)ML scale parameter estimate, if (P-)(RE)ML used for smoothness estimation.
  • residualsthe working residuals for the fitted model.
  • rVIf present, rV%*%t(rV)*sig2 gives the estimated Bayesian covariance matrix.
  • scalewhen present, the scale (as sig2)
  • scale.estimatedTRUE if the scale parameter was estimated, FALSE otherwise.
  • sig2estimated or supplied variance/scale parameter.
  • smoothlist of smooth objects, containing the basis information for each term in the model formula in the order in which they appear. These smooth objects are what gets returned by the smooth.construct objects.
  • spestimated smoothing parameters for the model. These are the underlying smoothing parameters, subject to optimization. For the full set of smoothing parameters multiplying the penalties see full.sp. Divide the scale parameter by the smoothing parameters to get, variance components, but note that this is not valid for smooths that have used rescaling to improve conditioning.
  • termsterms object of model model frame.
  • var.summaryA named list of summary information on the predictor variables. If a parametric variable is a matrix, then the summary is a one row matrix, containing the observed data value closest to the column median, for each matrix column. If the variable is a factor the then summary is the modal factor level, returned as a factor, with levels corresponding to those of the data. For numerics and matrix arguments of smooths, the summary is the mean, nearest observed value to median and maximum, as a numeric vector. Used by vis.gam, in particular.
  • Vefrequentist estimated covariance matrix for the parameter estimators. Particularly useful for testing whether terms are zero. Not so useful for CI's as smooths are usually biased.
  • Vpestimated covariance matrix for the parameters. This is a Bayesian posterior covariance matrix that results from adopting a particular Bayesian model of the smoothing process. Paricularly useful for creating credible/confidence intervals.
  • weightsfinal weights used in IRLS iteration.
  • yresponse data.

WARNINGS

This model object is different to that described in Chambers and Hastie (1993) in order to allow smoothing parameter estimation etc.

References

A Key Reference on this implementation:

Wood, S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman & Hall/ CRC, Boca Raton, Florida

Key Reference on GAMs generally:

Hastie (1993) in Chambers and Hastie (1993) Statistical Models in S. Chapman and Hall.

Hastie and Tibshirani (1990) Generalized Additive Models. Chapman and Hall.

See Also

gam