View source: R/redist_findparams.R
redist.findparams | R Documentation |
redist_flip
redist.findparams
is used to find optimal parameter values of
redist_flip
for a given map.
redist.findparams(
map,
nsims,
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
)
map |
A |
nsims |
The number of simulations run before a save point. |
init_plan |
A vector containing the congressional district labels
of each geographic unit. The default is |
adapt_lambda |
Whether to adaptively tune the lambda parameter so that the Metropolis-Hastings acceptance probability falls between 20% and 40%. Default is FALSE. |
adapt_eprob |
Whether to adaptively tune the edgecut probability parameter so that the Metropolis-Hastings acceptance probability falls between 20% and 40%. Default is FALSE. |
params |
A matrix of parameter values to test, such as the output of
|
ssdmat |
A matrix of squared distances between geographic
units. The default is |
group_pop |
A vector of populations for some sub-group of
interest. The default is |
counties |
A vector of county membership assignments. The default is |
nstartval_store |
The number of maps to sample from the preprocessing chain for use as starting values in future simulations. Default is 1. |
maxdist_startval |
The maximum distance from the starting map that sampled maps should be. Default is 100 (no restriction). |
maxiterrsg |
Maximum number of iterations for random seed-and-grow algorithm to generate starting values. Default is 5000. |
report_all |
Whether to report all summary statistics for each set of
parameter values. Default is |
parallel |
Whether to run separate parameter settings in parallel.
Default is |
ncores |
Number of parallel tasks to run, declared outside of the
function. Default is |
log |
Whether to open a log to track progress for each parameter combination being tested. Default is FALSE. |
verbose |
Whether to print additional information about the tests.
Default is |
This function allows users to test multiple parameter settings of
redist_flip
in preparation for a longer run for analysis.
redist.findparams
returns a print-out of summary statistics
about each parameter setting.
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)
## Get an initial partition
init_plan <- fl25_enum$plans[, 5118]
params <- expand.grid(eprob = c(.01, .05, .1))
# Make map
map_fl <- redist_map(fl25, ndists = 3, pop_tol = 0.2)
## Run the algorithm
redist.findparams(map_fl,
init_plan = init_plan, nsims = 10000, params = params)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.