vcov.gam | R Documentation |
Extracts the Bayesian posterior covariance matrix of the
parameters or frequentist covariance matrix of the parameter estimators
from a fitted gam
object.
## S3 method for class 'gam'
vcov(object, sandwich=FALSE, freq = FALSE, dispersion = NULL,unconditional=FALSE, ...)
object |
fitted model object of class |
sandwich |
compute sandwich estimate of covariance matrix. Currently expensive for discrete bam fits. |
freq |
|
dispersion |
a value for the dispersion parameter: not normally used. |
unconditional |
if |
... |
other arguments, currently ignored. |
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).
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
.
Henric Nilsson. Maintained by Simon N. Wood simon.wood@r-project.org
Wood, S.N. (2017) Generalized Additive Models: An Introductio with R (2nd ed) CRC Press
gam
require(mgcv)
n <- 100
x <- runif(n)
y <- sin(x*2*pi) + rnorm(n)*.2
mod <- gam(y~s(x,bs="cc",k=10),knots=list(x=seq(0,1,length=10)))
diag(vcov(mod))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.