Learn R Programming

redist (version 2.0.2)

redist.mcmc.anneal: MCMC Redistricting Simulator using Simulated Annealing

Description

redist.mcmc.anneal simulates congressional redistricting plans using Markov chain Monte Carlo methods coupled with simulated annealing.

Usage

redist.mcmc.anneal(adjobj, popvec, ndists,
initcds, num_hot_steps, num_annealing_steps,
num_cold_steps,
eprob, lambda, popcons, grouppopvec,
areasvec, countymembership, borderlength_mat,
ssdmat, constraint, constraintweights,
compactness_metric, rngseed, maxiterrsg,
adapt_lambda, adapt_eprob,
contiguitymap, exact_mh,
savename, verbose, ncores)

Arguments

adjobj

An adjacency matrix, list, or object of class "SpatialPolygonsDataFrame."

popvec

A vector containing the populations of each geographic unit

ndists

The numbe of congressional districts. The default is NULL.

initcds

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.

num_hot_steps

The number of steps to run the simulator at beta = 0. Default is 40000.

num_annealing_steps

The number of steps to run the simulator with linearly changing beta schedule. Default is 60000

num_cold_steps

The number of steps to run the simulator at beta = 1. Default is 20000.

eprob

The probability of keeping an edge connected. The default is 0.05.

lambda

The parameter detmerining the number of swaps to attempt each iteration fo the algoirhtm. The number of swaps each iteration is equal to Pois(lambda) + 1. The default is 0.

popcons

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.

grouppopvec

A vector of populations for some sub-group of interest. The default is NULL.

areasvec

A vector of precinct areas for discrete Polsby-Popper. The default is NULL.

countymembership

A vector of county membership assignments. The default is NULL.

borderlength_mat

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.

ssdmat

A matrix of squared distances between geographic units. The default is NULL.

constraint

Which constraint to apply. Accepts any combination of compact, segregation, population, similarity, or none (no constraint applied). The default is NULL.

constraintweights

The weights to apply to each constraint. Should be a vector the same length as constraint. Default is NULL.

compactness_metric

The compactness metric to use when constraining on compactness. Default is fryer-holden, the other implemented option is polsby-popper.

rngseed

Allows the user to set the seed for the simulations. Default is NULL.

maxiterrsg

Maximum number of iterations for random seed-and-grow algorithm to generate starting values. Default is 5000.

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.

contiguitymap

Use queens or rooks distance criteria for generating an adjacency list from a "SpatialPolygonsDataFrame" data type. Default is "rooks".

exact_mh

Whether to use the approximate (0) or exact (1) Metropolis-Hastings ratio calculation for accept-reject rule. Default is FALSE.

savename

Filename to save simulations. Default is NULL.

verbose

Whether to print initialization statement. Default is TRUE.

ncores

The number of cores available to parallelize over. Default is 1.