sandwich {sandwich} | R Documentation |
Constructing sandwich covariance matrix estimators by multiplying bread and meat matrices.
sandwich(x, bread. = bread, meat. = meat, ...)
x |
a fitted model object. |
bread. |
either a bread matrix or a function for computing
this via bread.(x) . |
meat. |
either a bread matrix or a function for computing
this via meat.(x, ...) . |
... |
arguments passed to the meat function. |
sandwich
is a simple convenience function that
takes a bread matrix (i.e., estimator of the expectation of the negative
derivative of the estimating functions) and a meat matrix (i.e.,
estimator of the variance of the estimating functions) and multiplies
them to a sandwich with meat between two slices of bread. By default
bread
and meat
are called.
Some theoretical background along with implementation details is given in Zeileis (2006).
A matrix containing the sandwich covariance matrix estimate. Typically, this should be an k x k matrix corresponding to k parameters.
Zeileis A (2006), Object-oriented Computation of Sandwich Estimators. Package vignette.
x <- sin(1:10) y <- rnorm(10) fm <- lm(y ~ x) sandwich(fm) vcovHC(fm, type = "HC")