Computes a heteroskedasticity-robust variance-covariance matrix.
Usage
# S3 method for class 'ral'
vcov(object, fit_idx = 1, type = "HC1", ...)Details
Let \(\hat\phi_i\) denote the estimated influence function at observation \(i\). Three variance estimators are available:
HC0: $$V_{\mathrm{HC0}} = \frac{1}{n^2}\sum_i \hat\phi_i\,\hat\phi_i'$$
HC1 (default): $$V_{\mathrm{HC1}} = V_{\mathrm{HC0}} \times \frac{n}{n - p}$$
HC3: $$V_{\mathrm{HC3}} = \frac{1}{n^2}\sum_i \frac{\hat\phi_i\,\hat\phi_i'} {(1 - \hat{h}_{\theta,i})^2}$$
where \(\hat{h}_{\theta,i}\) is the leverage;
see hatvalues.ral.
Cluster-robust inference. When
cluster_variable is non-NULL and identifies
fewer groups than observations, the observation-level
influence functions are aggregated to cluster-level
influence functions
$$\hat\Phi_g = \frac{G}{n} \sum_{i \in C_g} \hat\phi_i$$
and the variance is computed as
$$V_{\mathrm{HC0}} = \frac{1}{G^2} \sum_{g=1}^{G} \hat\Phi_g\,\hat\Phi_g'.$$