redist.combine.mpi
is used to combine successive runs of
redist.mcmc.mpi
into a single data object
redist.combine.mpi(savename, nloop, nthin, tempadj)
The name (without the loop or .RData
suffix)
of the saved simulations.
The number of loops being combined.
How much to thin the simulations being combined.
The temperature adjacency object saved by
redist.mcmc.mpi
.
redist.combine.mpi
returns an object of class "redist".
The object redist
is a list that contains the following components (the
inclusion of some components is dependent on whether tempering
techniques are used):
Matrix of congressional district assignments generated by the algorithm. Each row corresponds to a geographic unit, and each column corresponds to a simulation.
Vector containing the maximum distance from parity for a particular simulated redistricting plan.
A vector specifying whether a proposed redistricting plan was accepted (1) or rejected (0) in a given iteration.
A vector containing the Metropolis-Hastings acceptance probability for each iteration of the algorithm.
A vector containing the draw of the p
parameter for each
simulation, which dictates the number of swaps attempted.
A vector containing the value of the population constraint for each accepted redistricting plan.
A vector containing the value of the compactness constraint for each accepted redistricting plan.
A vector containing the value of the vra constraint for each accepted redistricting plan.
A vector containing the value of the similarity constraint for each accepted redistricting plan.
A vector containing the value of the QPS constraint for each accepted redistricting plan.
A vector containing the value of beta for each iteration of the algorithm. Returned when tempering is being used.
A vector specifying whether a proposed beta value was accepted (1) or rejected (0) in a given iteration of the algorithm. Returned when tempering is being used.
A vector containing the Metropolis-Hastings acceptance probability for each iteration of the algorithm. Returned when tempering is being used.
This function allows users to combine multiple successive runs of
redist.mcmc.mpi
into a single redist
object for analysis.
Fifield, Benjamin, Michael Higgins, Kosuke Imai and Alexander Tarr. (2016) "A New Automated Redistricting Simulator Using Markov Chain Monte Carlo." Working Paper. Available at http://imai.princeton.edu/research/files/redist.pdf.
if (FALSE) {
# Cannot run on machines without Rmpi
data(fl25)
data(fl25_enum)
data(fl25_adj)
## Code to run the simulations in Figure 4 in Fifield, Higgins, Imai and
## Tarr (2015)
## Get an initial partition
init_plan <- fl25_enum$plans[, 5118]
## Run the algorithm
redist.mcmc.mpi(adj = fl25_adj, total_pop = fl25$pop,
init_plan = init_plan, nsims = 10000, nloops = 2, savename = "test")
out <- redist.combine.mpi(savename = "test", nloop = 2,
nthin = 10, tempadj = tempAdjMat)
}