vcov
Variance-Covariance Matrix of the Estimated Coefficients
Description
Computes the variance-covariance matrix of the estimated
coefficients in a fitted model object.
Usage
vcov(object, ...)
## S3 method for class 'lm':
vcov(object, ...)
## S3 method for class 'glm':
vcov(object, ...)
## S3 method for class 'mlm':
vcov(object, ...)
## S3 method for class 'nls':
vcov(object, ...)
## S3 method for class 'summary.lm':
vcov(object, ...)
## S3 method for class 'summary.glm':
vcov(object, ...)
Arguments
object |
a fitted model object.
|
... |
other optional arguments pass to the method.
|
Details
This is a generic function, and several invisible methods have been
implemented for classes
Arima,
lm, mlm, glm, nls, summary.lm
and summary.glm.
of object.
For vcov.lm, it returns a matrix,
that is square of component sigma multiply component cov.unscaled of the summary's result of object.
For vcov.mlm, it returns Kronecker products of estimated
variance of object
and the component cov.unscaled of the first element of
summary's result of object.
For vcov.glm, it returns the component cov.scaled
of the summary's result of object.
For vcov.nls, it returns a matrix,
that is component cov.unscaled multiply square
of component sigma of the summary's result of object.
vcov.summary.lm andvcov.summary.glm are very similar
to vcov.lm and vcov.glm, respectively.
The only difference is that the argument object is
already a summary's result.
Value
returns the variance-covariance matrix of the estimated coefficients in the fitted model object.
Examples
# example for vcov.lm
lmfit <- lm(ozone ~ wind + temperature + radiation,
data=Sdatasets::air)
vcov(lmfit)
# example for vcov.summary.lm
vcov(summary.lm(lmfit))
# example for vcov.glm
glmfit <- glm(Kyphosis ~ Age + Number, family=binomial,
data=Sdatasets::kyphosis)
vcov(glmfit)
# example for vcov.summary.glm
vcov(summary.glm(glmfit))
# example for vcov.mlm
ymat <- with(Sdatasets::fuel.frame, cbind(Fuel, Mileage))
vcov(lm(ymat ~ Disp. + Weight, data=Sdatasets::fuel.frame))
# example for vcov.nls
vcov(nls(circumference ~ A/(1 + exp(-(age-B)/C)), data = Sdatasets::Orange,
start = list(A=150, B=600, C=400)))