LEGACY CONTENT. If you are looking for Voteview.com, PLEASE CLICK HERE

This site is an archived version of Voteview.com archived from University of Georgia on May 23, 2017. This point-in-time capture includes all files publicly linked on Voteview.com at that time. We provide access to this content as a service to ensure that past users of Voteview.com have access to historical files. This content will remain online until at least January 1st, 2018. UCLA provides no warranty or guarantee of access to these files.

Homework 2, POLS 8505: MEASUREMENT THEORY
Due 26 January 2015



  1. In this problem we are going to run Aldrich & McKelvey scaling on a 100 Point Ideology Scale from the 2008 CCES survey.

    Download the R program:

    #
    rm(list=ls(all=TRUE))
    #
    library(MASS)
    library(foreign)
    library(basicspace)  BasicSpace Package by James Lo, Jeff Lewis, Royce Carroll, and myself
    setwd("C:/uga_course_homework_12/")
    data <- read.dta("cces_2008.dta",convert.factors = FALSE)
    attach(data,warn.conflicts = FALSE)
    #
    T <- cbind(CC317a,CC317b,CC317c,CC317d,CC317h,CC317g)  0 - 100 Rating of Self and Candidates
    TT <- T
    TT <- ifelse(is.na(T),999,TT)
    mode(TT) <- "double"
    colnames(TT) <- c("self","D-Party","R-Party","Bush","Obama","McCain")
    #
    #  Note that polarity=2 selects D-Party -- The Respondent Self Placement
    #    is in the first column -- respondent=1
    #                              The Call to Aldrich and McKelvey Scaling
    result <- aldmck(TT,polarity=2,respondent=1,missing=c(999),verbose=TRUE)
    #
    #
    #  ---- Useful Commands To See What is in an Object
    #
    # > length(result)
    # [1] 8
    # > class(result)
    # [1] "aldmck"
    # > names(result)
    # [1] "stimuli"     "respondents" "eigenvalues" "AMfit"       "R2"         
    # [6] "N"           "N.neg"       "N.pos"      
    #
    # > names(result$respondents)
    # [1] "intercept" "weight"    "idealpt"   "R2"        "selfplace" "polinfo"  
    # 
    # > summary(result) -- shows everything
    # > plot(result) -- shows basic plots of results
    #
    windows()
    plot(result)   The Default Plot in the Package
    VOTE <- CC327
    VOTED <- ifelse(is.na(VOTE),999,VOTE) Get Who They Voted for
    idealpoints1 <- ifelse(is.na(result$respondents$weight),99,result$respondents$weight)   The Weight Parameter
    idealpoints2 <- ifelse(is.na(result$respondents$idealpt),99,result$respondents$idealpt) The scaled ideal point
    obama.voters <- result$respondents$idealpt[idealpoints1>0 & idealpoints2!=99 & VOTED==2] Obama voters
    mccain.voters <- result$respondents$idealpt[idealpoints1>0 & idealpoints2!=99 & VOTED==1] McCain voters
    #
    #crazy.voters <- idealpoints[(idealpoints[,2]>0 & idealpoints[,3]!=99 & (VOTED > 2 & VOTED <=9)),3]
    #crazy2.voters <- idealpoints[(idealpoints[,2]>0 & idealpoints[,3]!=99 & VOTED==999),3]
    # 10,364
    # 10,940
    #  2,207
    #  2,238
    obamaShare <- length(obama.voters)/(length(obama.voters)+length(mccain.voters))
    mccainShare <- length(mccain.voters)/(length(obama.voters)+length(mccain.voters))
    obamadens <- density(obama.voters)     Set up so that the Obama and McCain Densities sum to 1
    obamadens$y <- obamadens$y*obamaShare
    #
    mccaindens   <- density(mccain.voters)
    mccaindens$y <- mccaindens$y*mccainShare
    #
    ymax1 <- max(obamadens$y)
    ymax2 <- max(mccaindens$y)
    ymax <- 1.1*max(ymax1,ymax2)
    #
    windows()
    #
    plot(obamadens,xlab="",ylab="",
          main="",
          xlim=c(-2.0,2.0),ylim=c(0,ymax),type="l",lwd=3,col="red",font=2)
    lines(obamadens,lwd=3,col="blue")
    lines(mccaindens,lwd=3,col="red")
    #
    # Main title
    mtext("Aldrich-McKelvey Scaling 2008 CCES L-C Scale\nMcCain (red), Obama (blue)",side=3,line=1.50,cex=1.2,font=2)
    # x-axis title
    mtext("Liberal - Conservative",side=1,line=2.75,cex=1.2)
    # y-axis title
    mtext("Density",side=2,line=2.5,cex=1.2)
    #
    text(-1.5,ymax,paste("Obama Voters ",  
                    100.0*round(obamaShare, 3),"%"),col="blue",font=2)
    text(-1.5,0.9*ymax,paste("N = ",  
                    1.0*round(length(obama.voters), 7)),col="blue",font=2)
    text( 1.5,ymax,paste("McCain Voters ",
                    100.0*round(mccainShare, 3),"%"),col="red",font=2)
    text( 1.5,0.9*ymax,paste("N = ",
                    1.0*round(length(mccain.voters), 7)),col="red",font=2)
    #
    #
    #
    arrows(result$stimuli[4], 0.05,result$stimuli[4],0.0,length=0.1,lwd=3,col="blue4")  This is a nice way 
    text(result$stimuli[4],.075,"Obama",col="blue4",font=2)                             to show where the stimuli are
    arrows(result$stimuli[5], 0.05,result$stimuli[5],0.0,length=0.1,lwd=3,col="red4")
    text(result$stimuli[5],.075,"McCain",col="red4",font=2)
    arrows(result$stimuli[3], 0.05,result$stimuli[3],0.0,length=0.1,lwd=3,col="red4")
    text(result$stimuli[3],.10,"Bush",col="red4",font=2)
    #
    #
    detach(data)
    1. Run AM_L-C_2008_CCES.r and turn in the two plots that it makes.

    2. Report summary(result) NEATLY FORMATTED.

    3. How many non-voters are there? Does this seem odd to you? Explain.

  2. In this problem we are going to run Aldrich & McKelvey scaling on the Urban Unrest 7 Point Scale from the 1968 NES.

    Download the R program:

    1. Run basicspace_AM_Urban_Unrest_1968_Stata_2.r and turn in the two plots that it makes. Do the voter plots make sense in terms of basic spatial theory? Explain.

    2. Report summary(result) NEATLY FORMATTED.

  3. Modify basicspace_AM_Urban_Unrest_1968_Stata_2.r to scale the Vietnam 7 point scale. The variables are:

    T <- cbind(VAR00466,VAR00467,VAR00468,VAR00469,VAR00470)

    The end points were labeled 1 = IMMEDIATE WITHDRAWAL and 7 = COMPLETE MILITARY VICTORY. Change the labels on the plots appropriately.

    1. Run basicspace_AM_Vietnam_1968_2.r and turn in the two plots that it makes. Do the voter plots make sense in terms of basic spatial theory? Explain.

    2. Report summary(result) NEATLY FORMATTED.

    3. Compare the fits of this scaling with those for the Urban Unrest Scale. Why do you suppose they are different?

  4. Work Exercise (2) on pages 99-100 of Analyzing Spatial Models of Choice and Judgment with R. See the book website Analyzing Spatial Models of Choice and Judgment with R for the data.

    Here is an example program:

    Neatly format the display so that the labels do not overlap the histograms! Presentation matters!