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.

POLI 279 MEASUREMENT THEORY
Eighth Assignment
Due 16 June 2006


  1. In this problem we are going to use Simon Jackman's Bayesian MCMC Quadratic-Normal scaling program IDEAL to estimate two-dimensional ideal points for the 104th Senate.

    Download the R programs below along with the Rdata file for the 104th Senate roll calls and put them in the same directory:

    idealKeith2.r -- Program to run IDEAL on the 104th Senate.
    idealKeith2.r looks like this:
    #
    #
    #  idealKeith2.r -- Implements Simon's IDEAL in R
    #
    rm(list=ls(all=TRUE))
    #
    library(rollcall)
    load("C:/ucsd_homework_8/s104.Rdata")
    rc <- rollcall(s104)
    csts <- constrain.legis(rc,x=list("KENNEDY, ED"=c(-1,0),
                                       "HELMS"=c(1,0),
                                       "NUNN"=c(0,1)),d=2) 
    kpideal <- ideal(rc, d=2, priors=csts, startvals=csts, store.item=TRUE) 
    sumkpideal <- summary(kpideal,include.beta=TRUE)
    #
    xxzulu <- format(sumkpideal$x.quant, width=14, digits=8, nsmall=5, justify="left", scientific=FALSE)
    write.table(xxzulu,"c:/ucsd_homework_8/tab_simon2_104x_2_quants.txt",sep="   ",row.names = TRUE, col.names = FALSE)
    yyzulu <- format(sumkpideal$beta.quant, width=14, digits=8, nsmall=5, justify="left", scientific=FALSE)
    write.table(yyzulu,"c:/ucsd_homework_8/tab_simon2_104beta_2_quants.txt",sep="   ",row.names = TRUE, col.names = FALSE)
    #
    xzulu <- format(kpideal$x, width=14, digits=8, nsmall=5, justify="left", scientific=FALSE)
    write.table(xzulu,"c:/ucsd_homework_8/tab_simon2_104x_2.txt",sep="   ",row.names = FALSE, col.names = FALSE)
    yzulu <- format(kpideal$beta, width=14, digits=8, nsmall=5, justify="left", scientific=FALSE)
    write.table(yzulu,"c:/ucsd_homework_8/tab_simon2_104beta_2.txt",sep="   ",row.names = FALSE, col.names = FALSE)
    #
    This is essentially the same syntax as the one-dimensional version used in Question 2 of Homework 7 only I have added some code to try to get the output into a better format (with only limited success!).

    After you run the two-dimensional IDEAL the legislator ideal point file will look something like this:
    
    "HEFLINd1"   " 0.019254228028273"   "-0.079878095477918"   " 0.111449363496424"
    "HEFLINd2"   " 1.069517278759855"   " 0.868838382775220"   " 1.279517566620798"
    "SHELBYd1"   " 1.403612009699809"   " 1.252414688868802"   " 1.544233634475914"
    "SHELBYd2"   " 0.235868409260998"   "-0.014348727379616"   " 0.418772070489123"
    "MURKOWSKId1"   " 1.840154516370265"   " 1.678008774206082"   " 2.053228284099351"
    "MURKOWSKId2"   " 0.158078609318838"   "-0.050730011968662"   " 0.459155524940960"
       etc etc etc
    "KOHLd1"   "-0.782482605860982"   "-0.895595136215096"   "-0.661654268440642"
    "KOHLd2"   "-0.064279236064156"   "-0.182146234642706"   " 0.042390487275275"
    "SIMPSONd1"   " 0.999489090974373"   " 0.913485375624682"   " 1.109224896347494"
    "SIMPSONd2"   " 0.013901843849605"   "-0.115694946041413"   " 0.153525374932765"
    "THOMASd1"   " 1.778886363041898"   " 1.561671165023279"   " 2.004710391501360"
    "THOMASd2"   "-0.381946377022898"   "-0.550476255976928"   "-0.183191953276217"
    The first column of numbers is the Posterior Mean and the second and third are the 2.5% and 97.5% quantiles.

    1. Write an Epsilon that nicely formats this file (be sure to remove the "'s!). Turn in a neatly formatted listing of the file along with the macro. Note that you probably should arrange the file so that the 1st and 2nd dimension coordinates are on the same line along with the political party and state information.

    2. Use R to plot the legislators in two dimensions from the file you just created in (a). Use "D" for Non-Southern Democrats, "S" for Southern Democrats, "R" for Republicans, and "P" for President Clinton. This graph should be in the same format as the one you did for Problem 2.f of Homework 5.

    3. Replicate the above plot and add crosshairs for each Senator corresponding to the 95% quantiles. Neatly label the tokens for President Clinton, Senator John McCain, and Senator Edward Kennedy.

    4. kpideal$x is a 51 by 207 matrix that holds 51 values from the Markov chains for each Senator on each dimension (103*2 = 206 + column of names). Perform a t-test to see if Ben Nighthorse Campbell (CO) significantly changed his voting behavior after he switched parties from Democrat to Republican. In particular, note that Campbell (D-CO) is columns 23 (1-dim) and 24 (2-dim) of kpideal$x and Campbell (R-CO) is column 25 (1-dim) and column 26 (2-dim) of kpideal$x.

    5. Compare the two-dimensional coordinates from IDEAL with those you estimated using Optimal Classification in Problem 2.f of Homework 5. In particular, rotate the IDEAL coordinates so that the best match the Optimal Classification coordinates using the method shown in detail in Problem 1.g of Homework 7. Report the Pearson r-squares before and after rotating.

    6. Put the IDEAL coordinates and Optimal Classification coordinates in STATA and run the following regressions:

      OC-1st = b0 + b1(IDEAL-1st) + b2(IDEAL-2nd)

      OC-2nd = b0 + b1(IDEAL-1st) + b2(IDEAL-2nd)

      Report the standard STATA output for both of these regressions.

  2. In this problem we are going to use metric unfolding to analyze the thermometer scores from the 2004 election study in the same way that we did for question 3 of Homework 6. Download the the program, control card file, and data file and place them in the same directory.

    MLSMU6.EXE -- Metric Unfolding Program
    The format statement I used to read the data file is:
      100 FORMAT(31X,2I4,30X,I1,37X,A2,3I2,413X,14I3,113X,I2,2X,5I1,28X,I1,
         C       19X,I2,5I1,I2,5I1,5X,I2,5I1,I2,5I1,33X,I2,5I1,61X,I2,6X,I1,
         C       123X,I2,7X,I2,688X,I1,20X,I1,63X,33I3)
    The variables in the file are:
     I4 2004 Pre Case ID"      
     I4 2004 Post Case ID"
     I1 sex                              (1=Man, 2=Woman)
     A2 Postal abbreviation of state
     I2 FIPS state code
     I2 ICPSR state code
     I2 Congressional District number
     I3 Feeling Thermometer: GW Bush"
     I3 Feeling Thermometer: John Kerry"
     I3 Feeling Thermometer: Nader"
     I3 Feeling Thermometer: Cheney"
     I3 Feeling Thermometer: John Edwards"
     I3 Feeling Thermometer: Laura Bush"
     I3 Feeling Thermometer: Hillary Clinton"
     I3 Feeling Thermometer: Bill Clinton"
     I3 Feeling Thermometer: Colin Powell"
     I3 Feeling Thermometer: John Ashcroft"
     I3 Feeling Thermometer: John McCain"
     I3 Feeling Thermometer: Democratic party"
     I3 Feeling Thermometer: Republican party"
     I3 Feeling Thermometer: Ronald Reagan"
     I2 Liberal/conservative self-placement -7-point scale"
     I1 Liberal/conservative Placement - GW Bush"
     I1 Liberal/conservative Placement - Kerry"
     I1 Liberal/conservative Placement - Nader"
     I1 Liberal/conservative Placement - Dem Party"
     I1 Liberal/conservative Placement - Rep party"
     I1 Party ID (0=Strong Democrat -- 6=Strong Republican)   {end of first line of format statement}
     I2 Spending and Services - 7-point scale self-placement" C  GOVT SHOULD PROVIDE MANY FEWER SERVICES -- GOVT SHOULD PROVIDE MANY MORE SERVICES
     I1 Importance of spending/services issue to R"
     I1 Spending and Services Placement: GW Bush"
     I1 Spending and Services Placement: Kerry"
     I1 Spending and Services Placement: Dem party"
     I1 Spending and Services Placement: Rep party"
     I2 Defense spending - 7-point scale self-placement"  C  GOVT SHOULD DECREASE DEFENSE SPENDING -- GOVT SHOULD INCREASE DEFENSE SPENDING
     I1 Importance of defense spending issue to R"
     I1 Defense spending scale: GW Bush placement"
     I1 Defense spending scale: Kerry placement"
     I1 Defense spending scale: Dem party placement"
     I1 Defense spending scale: Rep party placement"
     I2 Job and Good Standard of Living -scale self-placement"  C  GOVT SHOULD SEE TO JOBS AND STANDARD OF LIVING -- GOVT SHOULD LET EACH PERSON GET AHEAD ON OWN
     I1 Importance of guaranteed jobs/standard living issue"
     I1 Job and Good Standard of Living - GW Bush placement"
     I1 Job and Good Standard of Living - Kerry placement"
     I1 Job and Good Standard of Living - Dem party placement"
     I1 Job and Good Standard of Living - Rep party placement"
     I2 Government assistance to blacks-7 point scale self-pl"  C  GOVT SHOULD HELP BLACKS -- BLACKS SHOULD HELP THEMSELVES
     I1 Importance of aid to blacks issue to R"
     I1 Aid to blacks Placement: GW Bush"
     I1 Aid to blacks Placement: Kerry"
     I1 Aid to blacks Placement: Dem party"
     I1 Aid to blacks Placement: Rep party"
     I2 Women's role - 7-point scale self-placement"  C  WOMEN AND MEN SHOULD HAVE EQUAL ROLES -- A WOMAN'S PLACE IS IN THE HOME
     I1 How important is the issue of women's equal role"
     I1 Women's role - GW Bush placement"
     I1 Women's role - Kerry placement"
     I1 Women's role - Dem party placement"
     I1 Women's role - Rep party placement"
     I2 Age (18 - 90, 00, 98, 99 missing)
     I1 Education (1=1-8, 2=9-11, 3=HS, 4=SC, 5=2YR degree, 6=BA, 7=Advanced, 0,8,9=Missing)  {end of 2nd line of format statement}
     I2 Income --  01.  None or less than $2,999
                   02.   $3,000 - $4,999 
                   03.   $5,000 - $6,999 
                   04.   $7,000 - $8,999 
                   05.   $9,000 - 10,999
                   06.  $11,000- $12,999
                   07.  $13,000- $14,999
                   08.  $15,000- $16,999
                   09.  $17,000- $19,999
                   10.  $20,000- $21,999
                   11.  $22,000- $24,999
                   12.  $25,000- $29,999
                   13.  $30,000- $34,999
                   14.  $35,000- $39,999
                   15.  $40,000- $44,999
                   16.  $45,000- $49,999
                   17.  $50,000- $59,999
                   18.  $60,000- $69,999
                   19.  $70,000- $79,999
                   20.  $80,000- $89,999
                   21.  $90,000-$104,999
                   22. $105,000-$119,000
                   23. $120,000 and over 
                   00 and > 24 missing
    I2  Race  10=Black (12,13,14,15, mixed Race)
              20=Asian (23,24,25, mixed Race)
              30=Native American (34,35, mixed Race)
              40=Hispanic (45, mixed Race)
              50=White
              70=Other
              88, 89, and all else missing
    I1  Voted?? (1=Voter, 2=Nonvoter Registered, 3=Nonvoter not Registered)
                0,4,5,6,7,8,9 Missing
    I1  Who Voted For (1=Kerry, 3=Bush, 5=Nader, 7,8,9,0=Missing)
    I3  Feeling Thermometer: Hispanics (Hispanic-Americans)"
    I3  Feeling Thermometer: Christian Fundamentalists"
    I3  Feeling Thermometer: Catholics"
    I3  Feeling Thermometer: Feminists"
    I3  Feeling Thermometer: Federal Government in Washington"
    I3  Feeling Thermometer: Jews"
    I3  Feeling Thermometer: Liberals"
    I3  Feeling Thermometer - middle class people"
    I3  Feeling Thermometer: Labor Unions"
    I3  Feeling Thermometer: Poor people"
    I3  Feeling Thermometer: The Military"
    I3  Feeling Thermometer: Big Business"
    I3  Feeling Thermometer: People on welfare"
    I3  Feeling Thermometer: Conservatives"
    I3  Feeling Thermometer: working class people"
    I3  Feeling Thermometer: Older people (the elderly)"
    I3  Feeling Thermometer: environmentalists"
    I3  Feeling Thermometer: U.S. Supreme Court"
    I3  Feeling Thermometer: Gay Men and Lesbians"
    I3  Feeling Thermometer: Asian Americans"
    I3  Feeling Thermometer: Congress"
    I3  Feeling Thermometer: Blacks"
    I3  Feeling Thermometer - Southerners"
    I3  Feeling Thermometer - men"
    I3  Feeling Thermometer - young people"
    I3  Feeling Thermometer - illegal immigrants"
    I3  Feeling Thermometer - rich people"
    I3  Feeling Thermometer - women"
    I3  Feeling Thermometer - business people"
    I3  Feeling Thermometer - the Catholic Church"
    I3  Feeling Thermometer: Whites"
    I3  Feeling Thermometer: Israel"
    I3  Feeling Thermometer: Muslims"  {end of 3rd line of format statement}
    
    Here is what UNFOLD_ELEC2004.CTL looks like:
    
    ELEC2004.DAT
       14    2    2   10    0    0
        1    1    0    4    3
        .001  -0.02    2.0     2.0     1.5     0.0   100.0
    (1X,4A1,18X,14F3.0)
    777888889
    BUSH
    KERRY
    NADER
    CHENEY
    EDWARDS
    LBUSH
    HCLINTON
    BCLINTON
    POWELL
    ASHCROFT
    MCCAIN
    DEMPARTY
    REPPARTY
    REAGAN
    Run MLSMU6.EXE and get the FORT.22 file. It should look something like this:
     BUSH             0.7726    0.2609  160.6132    0.7489 1212.0000
     KERRY           -0.8656    0.0173  116.4007    0.6712 1212.0000
     NADER            0.2228   -1.1055  235.2280    0.3139 1212.0000
     CHENEY           0.9038    0.3055  162.0310    0.6294 1212.0000
     EDWARDS         -0.6827   -0.5858  209.5535    0.5072 1212.0000
     LBUSH            0.5631    0.0922  164.3826    0.5649 1212.0000
     HCLINTON        -0.7768    0.2583  194.4952    0.6520 1212.0000
     BCLINTON        -0.7275    0.1688  186.9217    0.6771 1212.0000
     POWELL           0.3977   -0.1706  179.2403    0.4747 1212.0000
     ASHCROFT         0.7728   -0.8225  254.4220    0.4285 1212.0000
     MCCAIN           0.2972   -0.7873  247.2073    0.4570 1212.0000
     DEMPARTY        -0.7286    0.1384  133.5416    0.5838 1212.0000
     REPPARTY         0.7826    0.3116  132.1382    0.6533 1212.0000
     REAGAN           0.3954    0.2187  213.8857    0.4808 1212.0000
        1            -0.2800   -0.9550    7.6844    0.0104   14.0000
        2            -0.3859    0.2049    0.9326    0.7621   14.0000
        3             0.4892    0.0238    1.1449    0.7892   14.0000
        4            -0.2549    0.2999    4.8528    0.1328   14.0000
        5             0.8806   -0.0846    1.4779    0.9158   14.0000
            etc etc etc
    1. Use R to plot the 14 candidates/Political Figures in two dimensions. This plot should be very similar to the one you did for question 3 of Homework 6.

    2. Use Epsilon to insert the voted and voted for variables into FORT.22 (strip off the candidate coordinates first). Turn in the Epsilon macro you used to do the insertion and the first 20 lines of the file.

    3. Use R to make two-dimensional plots of the Voters, Non-Voters, Bush Voters only, and Kerry Voters only. Label each plot appropriately and use solid dots to plot the respondents. Turn in all these plots.

    4. Use R to make smoothed histograms -- using the first dimension from the thermometer scaling -- of the Voters and Non-Voters only, and the Kerry Voters, Bush Voters, and Non-Voters. Your Bush-Kerry-NonVoters plot should look like the one for Question 4.d of Homework 6.

  3. The aim of this problem is to analyze the 2004 Liberal-Conservative 7-Point Scale with the Aldrich-McKelvey scaling program (we used this program in Question 2 of Homework 6). Download the "control card" file:

    2004 Liberal-Conservative Control Card File

    and place it, MCKALNEW.EXE, and elec2004.dat hem in the same folder on a WINTEL machine. Read the Aldrich-McKelvey scaling program page to see how to run the program.

    1. Use R to make smoothed histograms of Democrats (0,1,2), Independents (4), and Republicans (4,5,6) over the scaled positions. Be sure the graph is neatly formatted and labeled like the one shown in Question 2.c of Homework 6.

    2. Use R to make smoothed histograms of just the Strong Democrats (0) and the Strong Republicans (6).