| vcov_hetero | R Documentation |
Computes the heteroskedasticity-robust VCOV of fixest objects.
vcov_hetero(
x,
type = "hc1",
exact = TRUE,
boot.size = NULL,
ssc = NULL,
vcov_fix = TRUE
)
x |
A |
type |
A string scalar equal to "HC1" (default), "HC2" or "HC3". Note that the case is ignored. |
exact |
Logical scalar, default is |
boot.size |
Integer scalar or |
ssc |
An object returned by the function |
vcov_fix |
Logical scalar, default is |
If the first argument is a fixest object, then a VCOV is returned (i.e. a symmetric matrix).
If the first argument is not a fixest object, then a) implicitly the arguments are shifted
to the left (i.e. vcov_hetero("HC3") is equivalent to vcov_hetero(type = "HC3") and b)
a VCOV-request is returned and NOT a VCOV. That VCOV-request can then
be used in the argument vcov of various fixest functions (e.g. vcov.fixest
or even in the estimation calls).
A custom small sample correction can be applied to the HC1 VCOV using the ssc argument
and function. By default an adjustment of N/(N-K) is applied to the VCOV, with N the number of
observations and K the number of parameters. If ssc(K.adj = FALSE), meaning that there is
no adjustment, this leads to the HC0 VCOV. Finally ssc's arguemnts
K.fixef and K.exact determine how to account for the parameters associated to the fixed-effects
(if the estimation contains fixed-effects).
Laurent Berge and Kyle Butts
MacKinnon, J. G. (2012). "Thirty years of heteroscedasticity-robust inference." Recent Advances and Future Directions in Causality, Prediction, and Specification Analysis, pp. 437–461. https://doi.org/10.1007/978-1-4614-1653-1_17
base = iris
names(base) = c("y", "x1", "x2", "x3", "species")
est = feols(y ~ x1 | species, base)
vcov_hetero(est, "hc1")
vcov_hetero(est, "hc1", ssc = ssc(K.adj = FALSE))
vcov_hetero(est, "hc2")
vcov_hetero(est, "hc3")
# Using approximate hatvalues
vcov_hetero(est, "hc3", exact = FALSE, boot.size = 500)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.