Reproduces sandwich::vcovHC. The meat is
\(X' \Omega X\) with \(\Omega\) the diagonal of adjusted
squared residuals, and the small-sample adjustment set by
type: HC0 (none), HC1 (\(n/(n-k)\)), HC2
(\(1/(1-h_i)\)), HC3 (\(1/(1-h_i)^2\)), HC4
(\(1/(1-h_i)^{\delta_i}\), \(\delta_i=\min(4, h_i/\bar h)\)),
HC4m, HC5.
References
MacKinnon, J. G., & White, H. (1985). Some heteroskedasticity-consistent covariance matrix estimators. Journal of Econometrics, 29(3), 305-325.
Examples
m <- lm(mpg ~ wt + hp, data = mtcars)
morie_vcov_hc(m, "HC1")
#> (Intercept) wt hp
#> (Intercept) 4.148289468 -1.093698573 -0.0021174032
#> wt -1.093698573 0.424066330 -0.0018197929
#> hp -0.002117403 -0.001819793 0.0000487394
