Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

vcovOPG

Outer-Product-of-Gradients Covariance Matrix Estimation


Description

Outer product of gradients estimation for the covariance matrix of the coefficient estimates in regression models.

Usage

vcovOPG(x, adjust = FALSE, ...)

Arguments

x

a fitted model object.

adjust

logical. Should a finite sample adjustment be made? This amounts to multiplication with n/(n-k) where n is the number of observations and k the number of estimated parameters.

...

arguments passed to the estfun function.

Details

In correctly specified models, the “meat” matrix (cross product of estimating functions, see meat) and the inverse of the “bread” matrix (inverse of the derivative of the estimating functions, see bread) are equal and correspond to the Fisher information matrix. Typically, an empirical version of the bread is used for estimation of the information but alternatively it is also possible to use the meat. This method is also known as the outer product of gradients (OPG) estimator (Cameron & Trivedi 2005).

Using the sandwich infrastructure, the OPG estimator could easily be computed via solve(meat(obj)) (modulo scaling). To employ numerically more stable implementation of the inversion, this simple convenience function can be used: vcovOPG(obj).

Note that this only works if the estfun() method computes the maximum likelihood scores (and not a scaled version such as least squares scores for "lm" objects).

Value

A matrix containing the covariance matrix estimate.

References

Cameron AC and Trivedi PK (2005). Microeconometrics: Methods and Applications. Cambridge University Press, Cambridge.

Zeileis A (2006). “Object-Oriented Computation of Sandwich Estimators.” Journal of Statistical Software, 16(9), 1–16. doi: 10.18637/jss.v016.i09

See Also

Examples

## generate poisson regression relationship
x <- sin(1:100)
y <- rpois(100, exp(1 + x))
## compute usual covariance matrix of coefficient estimates
fm <- glm(y ~ x, family = poisson)
vcov(fm)
vcovOPG(fm)

sandwich

Robust Covariance Matrix Estimators

v3.0-0
GPL-2 | GPL-3
Authors
Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Thomas Lumley [aut], Nathaniel Graham [ctb], Susanne Koell [ctb]
Initial release
2020-10-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.