R package for simulating redistricting plans via Markov chain Monte Carlo by Ben Fifield (email@example.com), Alex Tarr (firstname.lastname@example.org), Michael Higgins (email@example.com), and Kosuke Imai (firstname.lastname@example.org). Maintainer is Ben Fifield.
The package is available on CRAN and can be installed using:
Users can also install the most stable development release of the
redist package using the
install_github() function in the
We hope the following guide will be of help to users who want to take a look at the original
redist source code:
sw_mh_alg.cpp: Contains the
swMH()function, which conducts Markov chain Monte Carlo simulation of redistricting plans.
sw_mh_helper.cpp: A series of functions to aid in simulating redistricting plans.
make_swaps_helper.cpp: A series of functions to propose and make swaps of geographic units in the primary redistricting algorithm.
constraint_calc_helper.cpp: Functions to calculate the strength of certain implemented constraints such as population and compactness requirements.
rsg.cpp: An implementation of the random seed-and-grow algorithm described in detail in Chen and Rodden (2013).
check_contiguity.cpp: A contiguity check for the implementation of the Chen and Rodden (2013) algorithm in
redist_analysis.cpp: Functions to aid in analysis of simulated redistricting plans.
enumerate.cpp: Functions called by
enumerate.Rthat allow users to fully enumerate all valid, contiguous redistricting plans for a given set of geographic units.
- Flip sign for cold temperatures (currently fed in as negative values, should be positive to fit with paper)
- Feed in
betaweightsas a numeric argument with an exponential sequence
summaryfunction that calculates acceptance probability, the function call with parameters, and the distribution of
betavalues for tempering
lambdadynamic - for example, check acceptance probability every 50 iterations. If too high, increase