Learn R Programming

robustlmm (version 3.5.0-2)

vcov_sandwich: Robust cluster-sandwich covariance of the fixed effects of a fitted rlmerMod object.

Description

Computes the robust score sandwich \(\hat{V}_{IF} = \hat{A}^{-1} \hat{B} \hat{A}^{-T}\), where \(\hat{A}\) is the Schur-complement (marginal) Jacobian of the profiled \(\beta\)-score and \(\hat{B} = \sum_j s_j s_j^T\) sums the per-cluster \(\beta\)-score contributions \(s_j = \sum_{i \in j} x_i \psi_e(\hat{r}_i)\). Equal to the user-facing vcov(object, type = "sandwich").

Usage

vcov_sandwich(fit, cluster = NULL, correction = c("G1", "none"))

Value

A \(p \times p\) covariance matrix for \(\hat{\beta}\), with dimnames from the fixed-effect coefficient names and attribute

"n.clusters".

Arguments

fit

rlmerMod object.

cluster

Cluster specification; see resolveCluster.

correction

One of "G1" (default, applies \(J/(J-1)\)) or "none".

Details

Exact for a single (nested) grouping factor; approximate for crossed factors (a warning is issued via resolveCluster). With few clusters, set correction = "G1" (default) for the \(J/(J-1)\) small-sample scaling.

Small-J caveat. The G1 correction is necessary but not sufficient at very small \(J\): in a simulation study CI coverage drops to ~0.89 at \(J = 8\) (vs. nominal 0.95), and Wald-style hypothesis tests using the sandwich are anti-conservative (Type-I ~3-4x nominal). The function emits a warning for \(J < 20\). For inference at small \(J\) prefer vcov_type = "default" or pair the sandwich CI with a bootstrap calibration (e.g. confintROB); the sandwich is most useful at \(J \gtrsim 50\).

\(\hat{\sigma}, \hat{\theta}\) are held fixed (partial sandwich); the returned variance is the leading-order fixed-effects covariance.

See Also

vcov, caseweightIF