redist.flip
redist.findparams
is used to find optimal parameter values of
redist.flip
for a given map.
redist.findparams(
adj,
total_pop,
nsims,
ndists = NULL,
init_plan = NULL,
adapt_lambda = FALSE,
adapt_eprob = FALSE,
params,
ssdmat = NULL,
group_pop = NULL,
counties = NULL,
nstartval_store = 1,
maxdist_startval = 100,
maxiterrsg = 5000,
report_all = TRUE,
parallel = FALSE,
ncores = NULL,
log = FALSE,
verbose = TRUE,
adjobj,
popvec,
initcds,
grouppopvec,
countymembership,
nthreads
)
An adjacency matrix, list, or object of class "SpatialPolygonsDataFrame."
A vector containing the populations of each geographic unit.
The number of simulations run before a save point.
The number of congressional districts.
The default is NULL
.
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
.
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.
A matrix of parameter values to test, such as the output of
expand.grid
. Parameters accepted for params
include eprob
,
lambda
, pop_tol
, beta
, and constraint
.
A matrix of squared distances between geographic
units. The default is NULL
.
A vector of populations for some sub-group of
interest. The default is NULL
.
A vector of county membership assignments. The default is NULL
.
The number of maps to sample from the preprocessing chain for use as starting values in future simulations. Default is 1.
The maximum distance from the starting map that sampled maps should be. Default is 100 (no restriction).
Maximum number of iterations for random seed-and-grow algorithm to generate starting values. Default is 5000.
Whether to report all summary statistics for each set of
parameter values. Default is TRUE
.
Whether to run separate parameter settings in parallel.
Default is FALSE
.
Number of parallel tasks to run, declared outside of the
function. Default is NULL
.
Whether to open a log to track progress for each parameter combination being tested. Default is FALSE.
Whether to print additional information about the tests.
Default is TRUE
.
Deprecated, use adj. An adjacency matrix, list, or object of class "SpatialPolygonsDataFrame."
Deprecated, use total_pop. 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
.
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 ncores. Number of parallel tasks to run, declared outside of the
function. Default is NULL
.
redist.findparams
returns a print-out of summary statistics
about each parameter setting.
This function allows users to test multiple parameter settings of
redist.flip
in preparation for a longer run 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.
# NOT RUN {
data(fl25)
data(fl25_enum)
data(fl25_adj)
## Get an initial partition
init_plan <- fl25_enum$plans[, 5118]
params <- expand.grid(eprob = c(.01, .05, .1))
## Run the algorithm
redist.findparams(adj = fl25_adj, total_pop = fl25$pop,
init_plan = init_plan, nsims = 10000, params = params)
# }
Run the code above in your browser using DataLab