redist.combine
is used to combine successive runs of redist.flip
into a single data object
redist.combine(savename, nloop, nthin, temper)
The name (without the loop or .rds
suffix)
of the saved simulations.
The number of loops being combined. Savename must be non-null.
How much to thin the simulations being combined.
Whether simulated tempering was used (1) or not (0) in the simulations. Default is 0.
redist.combine
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 segregation 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 partisan constraint for each accepted redistricting plan.
A vector containing the value of the minority constraint for each accepted redistricting plan.
A vector containing the value of the hinge 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.
a redist object with entries combined
This function allows users to combine multiple successive runs of
redist.flip
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.
# \donttest{
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
set.seed(1)
temp <- tempdir()
# alg_253 <- redist.flip(adj = fl25_adj, total_pop = fl25$pop,
# init_plan = init_plan, nsims = 10000,
# nloop = 2, savename = paste0(temp, "/test"))
# out <- redist.combine(savename = paste0(temp, "/test"), nloop = 2, nthin = 10)
# }