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.
Value
A gam
object has the following elements:
aic | AIC 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. |
assign | Array whose elements indicate which model term (listed in |
boundary | did parameters end up at boundary of parameter space? |
call | the matched call (allows |
cmX | column means of the model matrix (with elements corresponding to smooths set to zero ) — useful for componentwise CI calculation. |
coefficients | the coefficients of the fitted model. Parametric coefficients are first, followed by coefficients for each spline term in turn. |
control | the |
converged | indicates whether or not the iterative fitting method converged. |
data | the original supplied data argument (for class |
db.drho | matrix of first derivatives of model coefficients w.r.t. log smoothing parameters. |
deviance | model deviance (not penalized deviance). |
df.null | null degrees of freedom. |
df.residual | effective residual degrees of freedom of the model. |
edf | estimated degrees of freedom for each model parameter. Penalization means that many of these are less than 1. |
edf1 | similar, but using alternative estimate of EDF. Useful for testing. |
edf2 | if estimation is by ML or REML then an edf that accounts for smoothing parameter uncertainty can be computed, this is it. |
family | family object specifying distribution and link used. |
fitted.values | fitted model predictions of expected value for each datum. |
formula | the model formula. |
full.sp | full array of smoothing parameters multiplying penalties (excluding any contribution from |
F | Degrees of freedom matrix. This may be removed at some point, and should probably not be used. |
gcv.ubre | The minimized smoothing parameter selection score: GCV, UBRE(AIC), GACV, negative log marginal likelihood or negative log restricted likelihood. |
hat | array of elements from the leading diagonal of the ‘hat’ (or ‘influence’) matrix. Same length as response data vector. |
iter | number of iterations of P-IRLS taken to get convergence. |
linear.predictors | fitted model prediction of link function of expected value for each datum. |
method | One of |
mgcv.conv | A list of convergence diagnostics relating to the |
min.edf | Minimum possible degrees of freedom for whole model. |
model | model frame containing all variables needed in original model fit. |
na.action | The |
nsdf | number of parametric, non-smooth, model terms including the intercept. |
null.deviance | deviance for single parameter model. |
offset | model offset. |
optimizer |
|
outer.info | If ‘outer’ iteration has been used to fit the model (see |
paraPen | If the |
pred.formula | one sided formula containing variables needed for prediction, used by |
prior.weights | prior weights on observations. |
pterms |
|
R | Factor R from QR decomposition of weighted model matrix, unpivoted to be in same column order as model matrix (so need not be upper triangular). |
rank | apparent rank of fitted model. |
reml.scale | The scale (RE)ML scale parameter estimate, if (P-)(RE)ML used for smoothness estimation. |
residuals | the working residuals for the fitted model. |
rV | If present, |
scale | when present, the scale (as |
scale.estimated |
|
sig2 | estimated or supplied variance/scale parameter. |
smooth | list 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 |
sp | estimated 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 |
terms |
|
var.summary | A 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 |
Ve | frequentist 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. |
Vp | estimated 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. |
Vc | Under ML or REML smoothing parameter estimation it is possible to correct the covariance matrix |
weights | final weights used in IRLS iteration. |
y | response data. |
WARNINGS
This model object is different to that described in Chambers and Hastie (1993) in order to allow smoothing parameter estimation etc.
Author(s)
Simon N. Wood [email protected]
References
A Key Reference on this implementation:
Wood, S.N. (2017) Generalized Additive Models: An Introduction with R (2nd edition). 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
Copyright (©) 1999–2012 R Foundation for Statistical Computing.
Licensed under the GNU General Public License.