Learn R Programming

refund (version 0.1-40)

assemble_cluster_sandwich: Assemble cluster-robust sandwich from score matrix

Description

Given a per-observation score matrix, aggregates by cluster and forms \(V_{CL} = c \cdot V_p M_{CL} V_p + B_2\) with HC1 correction.

Usage

assemble_cluster_sandwich(scores, cluster_id, Vp, B2)

Value

A p x p covariance matrix.

Arguments

scores

Per-observation score matrix (n_obs x p).

cluster_id

Cluster membership vector.

Vp

Bayesian posterior covariance (p x p).

B2

Bias correction matrix (p x p, or scalar 0).