vcov.gam: Extract parameter (estimator) covariance matrix from GAM fit
Description
Extracts the Bayesian posterior covariance matrix of the
parameters or frequentist covariance matrix of the parameter estimators
from a fitted gam object.
A matrix corresponding to the estimated frequentist covariance matrix
of the model parameter estimators/coefficients, or the estimated posterior
covariance matrix of the parameters, depending on the argument freq.
Arguments
object
fitted model object of class gam as produced by gam().
sandwich
compute sandwich estimate of covariance matrix. Currently expensive for discrete bam fits.
freq
TRUE to return the frequentist covariance matrix of the
parameter estimators, FALSE to return the Bayesian posterior covariance
matrix of the parameters. The latter option includes the expected squared bias
according to the Bayesian smoothing prior.
dispersion
a value for the dispersion parameter: not normally used.
unconditional
if TRUE (and freq==FALSE) then the Bayesian
smoothing parameter
uncertainty corrected covariance matrix is returned, if available.
Basically, just extracts object$Ve, object$Vp or object$Vc (if available) from a gamObject, unless sandwich==TRUE in which case the sandwich estimate is computed (with or without the squared bias component).
References
Wood, S.N. (2017) Generalized Additive Models: An Introductio with R (2nd ed) CRC Press