alpaca_vcovSandwich: Heteroskedasticity-robust variance-covariance matrix for...

View source: R/alpaca_vcov.R

alpaca_vcovSandwichR Documentation

Heteroskedasticity-robust variance-covariance matrix for alpaca feglm

Description

Wraps summary(mod, type = "sandwich") and returns a diagonal variance-covariance matrix that stargazer recognises and labels as "heteroskedasticity-robust standard errors".

Usage

alpaca_vcovSandwich(mod)

Arguments

mod

A fitted feglm object from the alpaca package.

Value

A square diagonal matrix of class "vcovAlpacaSandwich" with squared sandwich standard errors on the diagonal.

Examples


if (requireNamespace("alpaca", quietly = TRUE)) {
  d <- data.frame(
    y   = rbinom(200, 1, 0.5),
    x1  = rnorm(200),
    grp = factor(rep(1:10, 20))
  )
  mod <- alpaca::feglm(y ~ x1 | grp, d, binomial("logit"))
  V   <- alpaca_vcovSandwich(mod)
  stargazer(mod, vcov = list(V), type = "text")
}


stargazer2 documentation built on July 17, 2026, 5:08 p.m.