| alpaca_vcovCL | R Documentation |
Wraps summary(mod, type = "clustered", cluster = cluster) and
returns a diagonal variance-covariance matrix that stargazer
recognises and labels with the appropriate "clustered by ..." description.
alpaca_vcovCL(mod, cluster)
mod |
A fitted |
cluster |
A one-sided formula identifying the clustering variable(s).
Use |
A square diagonal matrix of class "vcovAlpacaCL" with a
"cluster" attribute containing the cluster formula.
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_vcovCL(mod, cluster = ~grp)
stargazer(mod, vcov = list(V), type = "text")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.