
Regression to the mean at selected hot spots
Source:R/regression_to_mean.R
morie_regression_to_mean.RdPlaces selected because their first-period count exceeds threshold
show, under the null of exchangeable periods, a non-positive mean change in
the second period (Research.P19.selected_change_nonpos); places
selected for being low show a non-negative one
(low_selected_change_nonneg). The function reports the observed
change on the selected places, the mirror change (selection on the second
period, read backwards), and the symmetrised change, which is the same
statistic on the exchangeable population made of the data and its
period-swapped copy, and is therefore non-positive by the theorem. The
difference between the observed and the symmetrised change is the part of
the drop that selection symmetry does not deliver; a treatment effect is
identified only against a control group selected the same way.
Value
A list with n_selected, selected_change (mean of
\(x_2 - x_1\) on the selected places), mirror_change,
symmetrised_change (always \(\le 0\)), excess_over_symmetry,
low_selected_change (places with x1 < threshold, always
\(\ge 0\) after symmetrisation: low_symmetrised_change) and
theorems.
Examples
set.seed(5)
mu <- rgamma(300, 2, 0.5) # stable place means
x1 <- rpois(300, mu); x2 <- rpois(300, mu) # no treatment, no trend
morie_regression_to_mean(x1, x2, threshold = quantile(x1, 0.9))[c("selected_change", "symmetrised_change")]
#> $selected_change
#> [1] -2.555556
#>
#> $symmetrised_change
#> [1] -2.211538
#>