This project was supported
by the Political Science program
of the National Science Foundation
To recreate the estimator, retrieve and unzip the original vintage MCMCpack files from CRAN
to your UNIX/LINUX machine. Copy the .cc and .r files below over the existing files of the same name, tarzip the files into a new package (MCMCpack_custom.tar.gz), and install the new custom package in R (R CMD INSTALL MCMCpack_custom.tar.gz).
MCMChierEI.cc : C++ code (copy to /src directory)
MCMChierEI.R : R language (copy to /r directory)
The sample R language below calls the datasets stored in the DATA folder, initializes and runs the MCMC simulation, and creates and stores a sample from the posterior distribution for the quantities of interest at the state level. The MCD posterior is available in R as an object named "posterior", but that file is not preserved/written after the session is terminated. The R program uses information from the posterior to create the state-level summary quantities that are archived as ESTIMATES. The sample from the MCD posterior is an extremely large file, so we do not archive each of these files. The Illinois 1920 posterior is available as a STATA dataset so that the figures from Chapter 4 can be replicated. All other posteriors can be produced with the R programs – each state/election simulation requires about 4 hours.
CT_1920.r : R commands to run the simulation for 1920 Connecticut and save the state-level estimates