Skip to contents

Least squares stays unbiased under heteroskedasticity; only its standard errors are wrong. The sandwich replaces the assumed \(sigma^2 (X'X)^-1\) with a middle built from the observed squared residuals, so nothing about the variance has to be modelled. HC0 is biased down in small samples, which is what HC1 to HC3 fix.

Usage

Robcov(X, y, kind = "HC0")

Arguments

X

Design; supply your own intercept column.

y

Response.

kind

One of HC0, HC1, HC2, HC3.

Value

List with estimate, coef, V, ols_se, n.

Details

Formula: \(V = (X'X)^-1 X' Omega X (X'X)^-1\), Omega = diag(w_i e_i^2); HC0 w = 1, HC1 n/(n-p), HC2 1/(1-h), HC3 1/(1-h)^2.

References

White, H. (1980). Econometrica 48:817-838; MacKinnon & White (1985) J Econometrics 29:305-325.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Robcov(V, V)
#> $estimate
#> [1] 1.107499e-16
#> 
#> $coef
#> [1] 1
#> 
#> $V
#>              [,1]
#> [1,] 1.226553e-32
#> 
#> $ols_se
#> [1] 9.197275e-17
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Sandwich heteroskedasticity-consistent standard errors"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"