Generate Gaussian latent site effects
Source:R/layer1-gen_effects_gaussian.R
gen_effects_gaussian.RdDraw J standardized site effects from the standard normal distribution and apply the shared Layer 1 location-scale wrapper to produce response-scale effects \(\tau_j = \tau + X_j\boldsymbol{\beta} + \sigma_\tau\,z_j\). The Gaussian shape is the canonical baseline of the eight-distribution catalog — pick it when you have no specific reason to prefer a heavier-tailed or asymmetric shape, or when matching the JEBS paper's reference design.
Usage
gen_effects_gaussian(
J,
tau = 0,
sigma_tau = 0.2,
variance = 1,
formula = NULL,
beta = NULL,
data = NULL
)Arguments
- J
Integer. Number of sites.
- tau
Numeric. Grand mean on the response scale. Default
0.- sigma_tau
Numeric (\(\ge 0\)). Between-site standard deviation on the response scale. Default
0.20.- variance
Numeric. Legacy Gaussian variance argument. Default
1. The unit-variance convention requiresvariance = 1; passing any other value aborts. Control heterogeneity throughsigma_tauinstead.- formula
One-sided formula for site-level covariates (e.g.,
~ x1 + x2), orNULL.- beta
Numeric coefficient vector matching
formula, orNULL.- data
A
data.framewith the predictors named informula, orNULL.
Value
A tibble with one row per site and columns site_index (integer
1:J), z_j (standard-normal residual), tau_j (response-scale
effect), plus any covariate columns from data.
Details
The standardized residuals \(z_j\) are drawn from \(\mathcal{N}(0, 1)\)
directly via rnorm; no rescaling is needed because the
standard normal already satisfies the unit-variance convention shared by
all Layer 1 generators (see gen_effects).
For the broader catalog of \(G\) distributions and a decision rubric on when to choose a heavier-tailed or asymmetric shape, see the G-distribution catalog and standardization vignette.
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 .
See also
gen_effects for the dispatcher and the full eight-shape
catalog;
gen_effects_studentt and gen_effects_skewn
for heavier-tailed and asymmetric variants;
the M2 G-distribution
catalog vignette.
Other family-effects:
gen_effects(),
gen_effects_ald(),
gen_effects_dpm(),
gen_effects_mixture(),
gen_effects_pmslab(),
gen_effects_skewn(),
gen_effects_studentt(),
gen_effects_user()
Examples
# Minimal: ten standardized Gaussian effects.
gen_effects_gaussian(J = 10L)
#> # A tibble: 10 × 3
#> site_index z_j tau_j
#> <int> <dbl> <dbl>
#> 1 1 -0.0242 -0.00484
#> 2 2 0.825 0.165
#> 3 3 -0.750 -0.150
#> 4 4 0.536 0.107
#> 5 5 -1.57 -0.315
#> 6 6 -0.986 -0.197
#> 7 7 1.98 0.397
#> 8 8 -1.85 -0.370
#> 9 9 -0.910 -0.182
#> 10 10 -1.95 -0.390
# Larger draw with a non-zero grand mean and modest heterogeneity.
gen_effects_gaussian(J = 50L, tau = 0.2, sigma_tau = 0.15)
#> # A tibble: 50 × 3
#> site_index z_j tau_j
#> <int> <dbl> <dbl>
#> 1 1 -0.800 0.0800
#> 2 2 -1.87 -0.0804
#> 3 3 -0.751 0.0874
#> 4 4 -0.591 0.111
#> 5 5 -0.742 0.0887
#> 6 6 0.694 0.304
#> 7 7 -0.0595 0.191
#> 8 8 -1.86 -0.0796
#> 9 9 -1.27 0.00882
#> 10 10 -1.78 -0.0673
#> # ℹ 40 more rows