avm.vcov {skedastic}R Documentation

Estimate Covariance Matrix of Ordinary Least Squares Estimators Using Error Variance Estimates from an Auxiliary Variance Model

Description

The function simply calculates

Covβ^=(XX)1XΩ^X(XX)1\mathrm{Cov}{\hat{\beta}}=(X'X)^{-1}X'\hat{\Omega}X(X'X)^{-1}

, where XX is the design matrix of a linear regression model and Ω^\hat{\Omega} is an estimate of the diagonal variance-covariance matrix of the random errors, whose diagonal elements have been obtained from an auxiliary variance model fit with alvm.fit or anlvm.fit.

Usage

avm.vcov(object, as_matrix = TRUE)

Arguments

object

Either an object of class "alvm.fit" or an object of class "anlvm.fit"

as_matrix

A logical. If TRUE (the default), a p×pp \times p matrix is returned, where pp is the number of columns in XX. Otherwise, a numeric vector of length pp is returned.

Value

Either a numeric matrix or a numeric vector, whose (diagonal) elements are Var^(β^j)\widehat{\mathrm{Var}}(\hat{\beta}_j), j=1,2,,pj=1,2,\ldots,p.

References

There are no references for Rd macro ⁠\insertAllCites⁠ on this help page.

See Also

alvm.fit, anlvm.fit, avm.fwls. If a matrix is returned, it can be passed to coeftest for implementation of a quasi-tt-test of significance of the β\beta coefficients.

Examples

mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
myalvm <- alvm.fit(mainlm = mtcars_lm, model = "linear",
   varselect = "qgcv.linear")
myvcov <- avm.vcov(myalvm)
lmtest::coeftest(mtcars_lm, vcov. = myvcov)


[Package skedastic version 2.0.2 Index]