| NY_subset | R Documentation |
These data are a subset of the 2008 Cooperative Congressional Election Survey (CCES) Common Content. Only 1108 respondents from the state of New York are included, with predictors drawn from Gill's (2020) model of self-reported ideology. The CCES data are merged with predictors on geographic location based on ZIP codes (from ArcGIS & TomTom) and county ruralism (from the USDA).
The NY_subset dataset has 1108 observations and 26 variables.
stateThe state abbreviation of the respondent's residence.
zipThe respondent's ZIP code.
ageThe age of the respondent in years.
femaleAn indicator of whether the respondent is female.
ideologyThe respondent's self-reported ideology on a scale of 0 (liberal) to 100 (conservative).
educThe respondent's level of education. 0=No Highschool, 1=High School Graduate, 2=Some College, 3=2-year Degree, 4=4-year degree, 5=Post-Graduate.
raceThe respondent's race. 1=White, 2=African American, 3=Nonwhite & nonblack.
empstatThe respondent's employment status. 1=employed, 2=unemployed, 3=not in workforce.
ownershipIndicator for whether the respondent owns his or her own home.
inc14The respondent's self reported income. 1=Less than $10,000, 2=$10,000-$14,999, 3=$15,000-$19,000, 4=$20,000-$24,999, 5=$25,000-$29,999, 6=$30,000-$39,999, 7=$40,000-$49,999, 8=$50,000-$59,999, 9=$60,000-$69,999, 10=$70,000-$79,999, 11=$80,000-$89,999, 12=$100,000-$119,999, 13=$120,000-$149,999, 14=$150,000 or more.
catholicIndicator for whether the respondent is Catholic.
mormonIndicator for whether the respondent is Mormon.
orthodoxIndicator for whether the respondent is Orthodox Christian.
jewishIndicator for whether the respondent is Jewish.
islamIndicator for whether the respondent is Muslim.
mainlineIndicator for whether the respondent is Mainline Christian.
evangelicalIndicator for whether the respondent is Evangelical Christian.
FIPS_CodeFIPS code of the repondent's state.
ruralNine-point USDA scale of the ruralism of each county, with 0 meaning the most urban and 8 meaning the most rural.
zipPopIndicates the population of the repondent's ZIP code.
zipLandKMIndicates the land area in square kilometers of the repondent's ZIP code.
weightSurvey weights created by the CCES.
cdThe congressional district the respondent resides in.
fipsCDIndex that fuses the state FIPS code in the first two digits and the congressional district number in the last two digits.
northingsIndicates the geographical location of the respondent in kilometer-based northings.
eastingsIndicates the geographical location of the respondent in kilometer-based eastings.
Ansolabehere, Stephen. 2011. "CCES, Common Content, 2008." Ver. 4.
ArcGIS. 2012. "USA ZIP Code Areas." https://www.arcgis.com/home/item.html?id=8d2012a2016e484dafaac0451f9aea24
United States Department of Agriculture. 2013. "2013 Rural-Urban Continuum Codes." https://www.ers.usda.gov/data-products/rural-urban-continuum-codes.aspx
Jeff Gill. 2020. Measuring Constituency Ideology Using Bayesian Universal Kriging.
State Politics & Policy Quarterly. doi:10.1177/1532440020930197
## Not run:
ny <- NY_subset
#data cleaning
ny$cathOrth<-ny$catholic+ny$orthodox
ny$consRelig<-ny$mormon+ny$evangelical
ny$jewMus<-ny$jewish+ny$islam
# Explanatory Variable Matrix
psrm.data <-cbind(ny$age, ny$educ, I(ny$age*ny$educ), as.numeric(ny$race==2),
as.numeric(ny$race==3), ny$female, I(as.numeric(ny$race==2)*ny$female),
I(as.numeric(ny$race==3)*ny$female), ny$cathOrth, ny$consRelig,
ny$jewMus, ny$mainline, ny$rural, ny$ownership,
as.numeric(ny$empstat==2), as.numeric(ny$empstat==3),ny$inc14)
dimnames(psrm.data)[[2]] <- c("Age", "Education", "Age.education",
"African.American", "Nonwhite.nonblack","Female",
"African.American.female", "Nonwhite.nonblack.female",
"Catholic.Orthodox", "Evang.Mormon", "Jewish.Muslim",
"Mainline","Ruralism", "Homeowner", "Unemployed",
"Not.in.workforce","Income")
# Outcome Variable
ideo <- matrix(ny$ideology,ncol=1)
# Set Number of Iterations:
# WARNING: 20 iterations is intensive on many machines.
# This example was tuned on Amazon Web Services (EC2) over many hours
# with 20,000 iterations--unsuitable in 2020 for most desktop machines.
#M<-20000
M<-100
set.seed(1,kind="Mersenne-Twister")
# Estimate the Model
ny.fit <- metropolis.krige(formula = ideo ~ psrm.data, coords = cbind(ny$eastings, ny$northings),
powered.exp=1, n.iter=M, spatial.share=0.31,range.share=0.23,beta.var=10,
range.tol=0.01, b.tune=0.1, nugget.tune=20, psill.tune=5)
# Discard first 20% of Iterations as Burn-In (User Discretion Advised).
ny.fit <- burnin(ny.fit, M/5)
# Summarize Results
summary(ny.fit)
#Convergence Diagnostics: Geweke and Heidelberger-Welch
geweke(ny.fit)
heidel.welch(ny.fit)
# Draw Semivariogram
semivariogram(ny.fit)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.