alarm-redist / redist

Simulation methods for legislative redistricting.
https://alarm-redist.github.io/redist/
GNU General Public License v2.0
67 stars 23 forks source link

Projective Distributions, Averages, and Contrasts #178

Closed CoryMcCartan closed 8 months ago

CoryMcCartan commented 10 months ago

The projective distribution of a district-level summary statistic (McCartan 2024) is the distribution of values of that statistic across a set of plans for the district each precinct belongs to. The projective average of a statistic is the average value of the projective distribution in each precinct. A projective contrast is the difference between the projective average for a single plan and the projective average for an ensemble of sampled plans.

This PR adds functions to calculate each of these, replacing the old avg_by_prec(), which is now deprecated. It also adds redist.plot.contr_fdr() which plots projective contrasts while controlling the positive false discovery rate (pFDR).

Adds matrixStats and ggpattern in Suggests so as not to bloat dependencies (though the former might be worth Importing, as it could simplify lots of our other code, potentially).

christopherkenny commented 9 months ago

Oops @CoryMcCartan, unclosed. Did the wrong thing to update dev

christopherkenny commented 8 months ago

@CoryMcCartan, can we remove ggpattern and require ggplot2 >= 3.5.0?