vcov {stats} | R Documentation |
Calculate Variance-Covariance Matrix for a Fitted Model Object
Description
Returns the variance-covariance matrix of the main parameters of
a fitted model object. The “main” parameters of model
correspond to those returned by coef
, and typically do
not contain a nuisance scale parameter (sigma
).
Usage
vcov(object, ...)
## S3 method for class 'lm'
vcov(object, complete = TRUE, ...)
## and also for '[summary.]glm' and 'mlm'
## S3 method for class 'aov'
vcov(object, complete = FALSE, ...)
.vcov.aliased(aliased, vc, complete = TRUE)
Arguments
object |
a fitted model object, typically. Sometimes also a
|
complete |
for the |
... |
additional arguments for method functions. For the
|
aliased |
a |
vc |
a variance-covariance matrix, typically “incomplete”, i.e., with no rows and columns for aliased coefficients. |
Details
vcov()
is a generic function and functions with names beginning
in vcov.
will be methods for this function.
Classes with methods for this function include:
lm
, mlm
, glm
, nls
,
summary.lm
, summary.glm
,
negbin
, polr
, rlm
(in package MASS),
multinom
(in package nnet)
gls
, lme
(in package nlme),
coxph
and survreg
(in package survival).
(vcov()
methods for summary objects allow more
efficient and still encapsulated access when both
summary(mod)
and vcov(mod)
are needed.)
.vcov.aliased()
is an auxiliary function useful for
vcov
method implementations which have to deal with singular
model fits encoded via NA coefficients: It augments a vcov–matrix
vc
by NA
rows and columns where needed, i.e., when
some entries of aliased
are true and vc
is of smaller dimension
than length(aliased)
.
Value
A matrix of the estimated covariances between the parameter estimates
in the linear or non-linear predictor of the model. This should have
row and column names corresponding to the parameter names given by the
coef
method.
When some coefficients of the (linear) model are undetermined and
hence NA
because of linearly dependent terms (or an
“over specified” model), also called
“aliased”, see alias
, then since R version 3.5.0,
vcov()
(iff complete = TRUE
, i.e., by default for
lm
etc, but not for aov
) contains corresponding rows and
columns of NA
s, wherever coef()
has always
contained such NA
s.