Robust / heteroskedasticity-consistent variance for a fitted model
Source:R/causal.R
morie_causal_robust_se.RdThin wrapper around sandwich variance estimators. Returns the requested variance-covariance matrix and the corresponding robust standard errors. Supports HC0-HC5 (cross-section), HAC (time-series), and clustered (one-way) variance.
Arguments
- model
A fitted model object (typically from
stats::lmorstats::glm) compatible withsandwich::vcovHC(),sandwich::vcovHAC(), orsandwich::vcovCL().- type
One of
"HC0","HC1","HC2","HC3","HC4","HC4m","HC5","HAC", or"CL"(clustered). Default"HC3"(Long-Ervin small-sample default).- cluster
Optional one-sided formula or vector identifying the cluster variable (required when
type = "CL").- ...
Additional arguments forwarded to the chosen sandwich estimator.
Value
Named list with elements vcov (variance matrix),
se (named numeric vector of robust SEs), type,
and n_coef.