# vcov

##### Calculate Variance-Covariance Matrix for a Fitted Model Object

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 lm
vcov(object, complete = TRUE, …)
## and also for '[summary.]glm' and 'mlm'
# S3 method for aov
vcov(object, complete = FALSE, …)
```.vcov.aliased(aliased, vc, complete = TRUE)

##### Arguments

- object
a fitted model object, typically. Sometimes also a

`summary()`

object of such a fitted model.- complete
for the

`aov`

,`lm`

,`glm`

,`mlm`

, and where applicable`summary.lm`

etc methods: logical indicating if the full variance-covariance matrix should be returned also in case of an over-determined system where some coefficients are undefined and`coef(.)`

contains`NA`

s correspondingly. When`complete = TRUE`

,`vcov()`

is compatible with`coef()`

also in this singular case.- …
additional arguments for method functions. For the

`glm`

method this can be used to pass a`dispersion`

parameter.- aliased
a

`logical`

vector typically identical to`is.na(coef(.))`

indicating which coefficients are ‘aliased’.- 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.

*Documentation reproduced from package stats, version 3.6.1, License: Part of R 3.6.1*