Skip to contents

Compute the realized Spearman rank correlation between the latent effect column and the per-site sampling variance. Group B diagnostic (realized dependence): "Did the simulated dataset reproduce the precision-dependence pattern I asked for?"

Usage

realized_rank_corr(x, on = c("residual", "marginal"))

Arguments

x

A multisitedgp_data object.

on

Character. "residual" (default) uses z_j; "marginal" uses tau_j.

Value

A scalar double in [-1, 1], or NA_real_ when either margin is constant.

Details

on = "residual" (default) uses z_j — the design target of Layer 3 aligners. on = "marginal" uses tau_j — important when site-level covariates contribute to the marginal correlation without affecting the residual.

References

Lee, J., Che, J., Rabe-Hesketh, S., Feller, A., & Miratrix, L. (2025). Improving the estimation of site-specific effects and their distribution in multisite trials. Journal of Educational and Behavioral Statistics, 50(5), 731–764. doi:10.3102/10769986241254286 .

Examples

dat <- sim_multisite(J = 50L, dependence = "rank", rank_corr = 0.3, seed = 1L)
realized_rank_corr(dat)
#> [1] 0.2999904
realized_rank_corr(dat, on = "marginal")
#> [1] 0.2999904