redist.mcmc is used to simulate Congressional redistricting
plans using Markov Chain Monte Carlo methods.redist.mcmc(adjobj, popvec, nsims, ndists = NULL, initcds = NULL, loopscompleted = 0,
nloop = 1, nthin = 1, eprob = 0.05, lambda = 0,
popcons = NULL, grouppopvec = NULL, ssdmat = NULL,
betacompact = 0, betapop = 0,
betaseg = 0, betasimilar = 0,
temperbetacompact = 0, temperbetapop = 0,
temperbetaseg = 0, temperbetasimilar = 0,
betaseq = "powerlaw", betaseqlength = 10,
betaweights = NULL,
adjswaps = TRUE, rngseed = NULL,
savename = NULL, verbose = TRUE)NULL.NULL. If not provided, random and contiguous
congressional district assignments will be generated using redist.rsg.0.1. Note that the total number of simulations run
will be nsims * nloop.1.0.05.lambda) + 1. The default is 0.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.NULL.NULL.betacompact less than zero impose more
compactness. The default is 0 (no constraint).betapop less than zero bring the simulated
districts closer to population parity. The default is 0 (no constraint).betaseg greater than
zero will create districts with higher concentrations of the
subgroup. The default is 0 (no constraint).betasimilar less than
zero will create districts more similar to the specified plan. The
default is 0 (no constraint).betacompact constraint. The default is 0 (no tempering).betacompact constraint. The default is 0 (no
tempering).betaseg constraint. The default is 0 (no tempering).betasimilar constraint. The default is 0 (no
tempering).powerlaw (see Fifield et. al (2015) for details).10.NULL (equal weighting).TRUE.NULL.NULL.TRUE.redist.mcmc returns an object of class "redist". The object
redist is a list that contains the folowing components (the
inclusion of some components is dependent on whether tempering
techniques are used):p parameter for each simulation, which dictates the number of swaps attempted.redist.ipw for inverse probability weighting functionality.data(algdat.pfull)
## Code to run the simulations in Figure 4 in Fifield, Higgins, Imai and Tarr (2015)
## Get an initial partition
set.seed(1)
initcds <- algdat.pfull$cdmat[,sample(1:ncol(algdat.pfull$cdmat), 1)]
## Run the algorithm
alg_253 <- redist.mcmc(adjobj = algdat.pfull$adjlist,
popvec = algdat.pfull$precinct.data$pop,
initcds = initcds,
nsims = 10000)Run the code above in your browser using DataLab