Aggregates weighted scores to the stratum–PSU level and computes the Taylor linearisation variance estimator with finite population correction (FPC) at the stratum level.
Arguments
- scores
Numeric matrix of dimension \(N \times D\). The posterior mean score matrix from
compute_score_matrix().- hbb_data
An S3 object of class
"hbb_data"(fromprepare_stan_data()) or a list containing the fieldsstratum_idx,psu_idx,w_tilde, andN.
Value
Numeric matrix of dimension \(D \times D\). The cluster-robust meat matrix (positive semi-definite).
Details
Algorithm
For each stratum \(h\) with \(C_h\) PSUs:
Compute weighted score totals per PSU: \(s_{hc} = \sum_{i \in \mathrm{PSU}(h,c)} \tilde{w}_i s_i\)
Compute stratum mean: \(\bar{s}_h = C_h^{-1} \sum_c s_{hc}\)
Center: \(\delta_{hc} = s_{hc} - \bar{s}_h\)
Accumulate with FPC: \(J_h = \frac{C_h}{C_h - 1} \sum_c \delta_{hc} \delta_{hc}^\top\)
Uses rowsum() for efficient PSU-level aggregation.
Singleton strata (\(C_h = 1\)) are skipped with a warning.