Skip to contents

A single entry point over the native HC / HAC / CL estimators, mirroring the type vocabulary used by morie_causal_robust_se().

Usage

morie_vcov_robust(model, type = "HC3", cluster = NULL, ...)

Arguments

model

A fitted lm / glm.

type

"HC0"-"HC5", "HC4m", "const", "HAC", or "CL".

cluster

Cluster vector (required for "CL").

...

Passed to the underlying estimator (e.g. lag).

Value

The coefficient covariance matrix.

Examples

set.seed(1)
df <- data.frame(y = rnorm(60), x = rnorm(60),
                 cl = rep(1:6, each = 10))
fit <- stats::lm(y ~ x, data = df)
morie_vcov_robust(fit)
#>              (Intercept)            x
#> (Intercept)  0.014406146 -0.007860219
#> x           -0.007860219  0.018845371