redist.flip.anneal
simulates congressional redistricting plans
using Markov chain Monte Carlo methods coupled with simulated annealing.
redist.flip.anneal
simulates congressional redistricting plans
using Markov chain Monte Carlo methods coupled with simulated annealing.
redist.mcmc.anneal(
adj,
total_pop,
ndists = NULL,
init_plan = NULL,
num_hot_steps = 40000,
num_annealing_steps = 60000,
num_cold_steps = 20000,
eprob = 0.05,
lambda = 0,
pop_tol = NULL,
group_pop = NULL,
areasvec = NULL,
counties = NULL,
borderlength_mat = NULL,
ssdmat = NULL,
constraint = NULL,
constraintweights = NULL,
compactness_metric = "fryer-holden",
partisan_metric = "efficiency-gap",
rngseed = NULL,
maxiterrsg = 5000,
adapt_lambda = FALSE,
adapt_eprob = FALSE,
exact_mh = FALSE,
savename = NULL,
verbose = TRUE,
ncores = 1,
tgt_min = 0.55,
tgt_other = 0.25,
rvote = NULL,
dvote = NULL,
minorityprop = NULL,
adjobj,
popvec,
initcds,
popcons,
grouppopvec,
countymembership,
contiguitymap
)redist.flip.anneal(
adj,
total_pop,
ndists = NULL,
init_plan = NULL,
num_hot_steps = 40000,
num_annealing_steps = 60000,
num_cold_steps = 20000,
eprob = 0.05,
lambda = 0,
pop_tol = NULL,
group_pop = NULL,
areasvec = NULL,
counties = NULL,
borderlength_mat = NULL,
ssdmat = NULL,
constraint = NULL,
constraintweights = NULL,
compactness_metric = "fryer-holden",
partisan_metric = "efficiency-gap",
rngseed = NULL,
maxiterrsg = 5000,
adapt_lambda = FALSE,
adapt_eprob = FALSE,
exact_mh = FALSE,
savename = NULL,
verbose = TRUE,
ncores = 1,
tgt_min = 0.55,
tgt_other = 0.25,
rvote = NULL,
dvote = NULL,
minorityprop = NULL,
adjobj,
popvec,
initcds,
popcons,
grouppopvec,
countymembership,
contiguitymap
)
adjacency matrix, list, or object of class "SpatialPolygonsDataFrame."
A vector containing the populations of each geographic unit
The number of congressional districts. The default is
NULL
.
A vector containing the congressional district labels
of each geographic unit. If not provided, random and contiguous congressional
district assignments will be generated using redist.smc
. To use the old
behavior of generating with redist.rsg
, provide init_plan = 'rsg'.
The number of steps to run the simulator at beta = 0. Default is 40000.
The number of steps to run the simulator with linearly changing beta schedule. Default is 60000
The number of steps to run the simulator at beta = 1. Default is 20000.
The probability of keeping an edge connected. The
default is 0.05
.
The parameter determining the number of swaps to attempt
each iteration of the algorithm. The number of swaps each iteration is
equal to Pois(lambda
) + 1. The default is 0
.
The strength of the hard population
constraint. pop_tol
= 0.05 means that any proposed swap that
brings a district more than 5% away from population parity will be
rejected. The default is NULL
.
A vector of populations for some sub-group of
interest. The default is NULL
.
A vector of precinct areas for discrete Polsby-Popper.
The default is NULL
.
A vector of county membership assignments. The default is NULL
.
A matrix of border length distances, where
the first two columns are the indices of precincts sharing a border and
the third column is its distance. Default is NULL
.
A matrix of squared distances between geographic
units. The default is NULL
.
Which constraint to apply. Accepts any combination of compact
,
segregation
, vra
, population
, similarity
, partisan
,
minority
, hinge
, countysplit
, or none
(no constraint applied). The default is NULL.
The weights to apply to each constraint. Should be a vector the same length as constraint. Default is NULL.
The compactness metric to use when constraining on
compactness. Default is fryer-holden
, the other implemented options
are polsby-popper
and edges-removed
.
The partisan metric to use when constraining on partisan metrics. Only implemented are "efficiency-gap" (default) and "proportional-representation".
Allows the user to set the seed for the
simulations. Default is NULL
.
Maximum number of iterations for random seed-and-grow algorithm to generate starting values. Default is 5000.
Whether to adaptively tune the lambda parameter so that the Metropolis-Hastings acceptance probability falls between 20% and 40%. Default is FALSE.
Whether to adaptively tune the edgecut probability parameter so that the Metropolis-Hastings acceptance probability falls between 20% and 40%. Default is FALSE.
Whether to use the approximate (0) or exact (1) Metropolis-Hastings ratio calculation for accept-reject rule. Default is FALSE.
Filename to save simulations. Default is NULL
.
Whether to print initialization statement.
Default is TRUE
.
The number of cores available to parallelize over. Default is 1.
The majority minority target percent as a decimal. Default is 0.55.
The remaining target percent as a decimal. Default is 0.25.
integer vector of votes for Republicans by precinct
integer vector of votes for Democrats by precinct
numeric vector of targeted minority proportions for the top districts with that proportion
Deprecated, use adj. An adjacency matrix, list, or object of class "SpatialPolygonsDataFrame."
A vector containing the populations of each geographic unit
Deprecated, use init_plan. A vector containing the congressional district labels
of each geographic unit. The default is NULL
. If not provided,
random and contiguous congressional district assignments will be generated
using redist.rsg
.
Deprecated, use pop_tol. The strength of the hard population
constraint. popcons
= 0.05 means that any proposed swap that
brings a district more than 5% away from population parity will be
rejected. The default is NULL
.
Deprecated, use group_pop. A vector of populations for some sub-group of
interest. The default is NULL
.
Deprecated, use counties. A vector of county membership assignments. The default is NULL
.
Deprecated. Use queens or rooks distance criteria for generating an adjacency list from a "SpatialPolygonsDataFrame" data type. Default is "rooks".
list of class redist