redist.combine | R Documentation |
redist.flip
redist.combine
is used to combine successive runs of redist.flip
into a single data object
redist.combine(savename, nloop, nthin, temper)
savename |
The name (without the loop or |
nloop |
The number of loops being combined. Savename must be non-null. |
nthin |
How much to thin the simulations being combined. |
temper |
Whether simulated tempering was used (1) or not (0) in the simulations. Default is 0. |
This function allows users to combine multiple successive runs of
redist.flip
into a single redist
object for analysis.
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):
plans |
Matrix of congressional district assignments generated by the algorithm. Each row corresponds to a geographic unit, and each column corresponds to a simulation. |
distance_parity |
Vector containing the maximum distance from parity for a particular simulated redistricting plan. |
mhdecisions |
A vector specifying whether a proposed redistricting plan was accepted (1) or rejected (0) in a given iteration. |
mhprob |
A vector containing the Metropolis-Hastings acceptance probability for each iteration of the algorithm. |
pparam |
A vector containing the draw of the |
constraint_pop |
A vector containing the value of the population constraint for each accepted redistricting plan. |
constraint_compact |
A vector containing the value of the compactness constraint for each accepted redistricting plan. |
constraint_segregation |
A vector containing the value of the segregation constraint for each accepted redistricting plan. |
constraint_vra |
A vector containing the value of the vra constraint for each accepted redistricting plan. |
constraint_similar |
A vector containing the value of the similarity constraint for each accepted redistricting plan. |
constraint_partisan |
A vector containing the value of the partisan constraint for each accepted redistricting plan. |
constraint_minority |
A vector containing the value of the minority constraint for each accepted redistricting plan. |
constraint_hinge |
A vector containing the value of the hinge constraint for each accepted redistricting plan. |
constraint_qps |
A vector containing the value of the QPS constraint for each accepted redistricting plan. |
beta_sequence |
A vector containing the value of beta for each iteration of the algorithm. Returned when tempering is being used. |
mhdecisions_beta |
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. |
mhprob_beta |
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
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.