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 6 June 2007


  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 program below:

    idealKeith2_2007.r -- Program to run IDEAL on the 104th Senate.

    idealKeith2_2007.r looks like this:
    #
    #
    #  idealKeith2_2007.r -- Implements Simon's IDEAL in R
    #
    rm(list=ls(all=TRUE))
    #
    library(pscl)
    #
    s104 <- readKH("https://legacy.voteview.com/k7ftp/sen104kh.ord",dtl=NULL,
                     yea=c(1,2,3),
                     nay=c(4,5,6),
                     missing=c(7,8,9),
                     notInLegis=0,
                     desc="104th U.S. Senate",
                     debug=FALSE)
    class(s104)
    csts <- constrain.legis(s104,x=list("KERRY (D MA)"=c(-1,0), 
                                        "HELMS (R NC)"=c(1,0),
                                        "NUNN (D GA)"=c(0,1)),d=2)
    kpideal <- ideal(s104, d=2, priors=csts, startvals=csts, store.item=TRUE)
    sumkpideal <- summary(kpideal,include.beta=TRUE)
    #
    write.table(sumkpideal$x,"c:/ucsd_homework_8/tab_simon_104_2x.txt")
    write.table(sumkpideal$bResults,"c:/ucsd_homework_8/tab_simon_104_2z.txt")
    #
    #
    This is essentially the same syntax as the one-dimensional version used in Question 4 of Homework 7.

    After you run the two-dimensional IDEAL the legislator ideal point file will look something like this:
    
    "Mean" "Std.Dev." "X2.5." "X97.5." "Mean.1" "Std.Dev..1" "X2.5..1" "X97.5..1"
    "KERRY (D MA)" -1.00000005627657 1.05914228842044e-06 -1.00000179500486 -0.999998270145548 -0.184805722127767 0.237887439214594 -0.797986254362587 0.033735899310156
    "FEINGOLD (D WI)" -0.696592428401382 0.129841470314019 -0.941492147338116 -0.500959048506417 -0.113812808266703 0.184708595636727 -0.620816560645933 0.0909311930520861
    "KENNEDY (D MA)" -0.39853678895477 0.0348101416889358 -0.474887262758531 -0.344384836730444 -0.0419015311860792 0.175676216361879 -0.51236114421886 0.127441110990893
    "WELLSTONE (D MN)" -0.394472989188181 0.0505389157441363 -0.50230656593278 -0.324065661438437 -1.26553289115466e-07 8.39900671523795e-07 -1.71648213950764e-06 1.43565231452832e-06
    "BOXER (D CA)" -0.359994595662614 0.0315688541597476 -0.413300705101129 -0.293160296396817 1.91042358878488e-07 1.13289345859989e-06 -2.15080233070791e-06 2.17709557004076e-06
    "LAUTENBERG (D NJ)" -0.354489034997133 0.0443511585876246 -0.439334506519077 -0.281497637829805 0.018501335616282 0.146593189108768 -0.309016960590407 0.20089769581956
    "LEVIN (D MI)" -0.35130467060205 0.0322673911446749 -0.40390752166505 -0.290724378138242 0.0372879181805635 0.151710224940279 -0.362926451554599 0.222620548737536
    "AKAKA (D HI)" -0.346673597103296 0.0365018011509167 -0.427312625973083 -0.287771536726954 0.044432457357071 0.147787204439382 -0.266113396846850 0.222186924676193
    "SARBANES (D MD)" -0.342255802922513 0.0322895049085901 -0.397969074011471 -0.283946032880567 0.050642273164567 0.131994074902861 -0.285411996832474 0.19903076992167
    "CLINTON (D USA)" -0.337869197736866 0.0670075272235685 -0.474811342173269 -0.216025697154335 0.0560157564502081 0.157117903168647 -0.311011778480377 0.253091750357016
    "MURRAY (D WA)" -0.28597620787783 0.0263509206674688 -0.330199572684002 -0.237279414250368 0.0654126045046062 0.156371572398615 -0.314358137127277 0.226852813524100
    "DASCHLE (D SD)" -0.281738966323341 0.0256147235268329 -0.336768614860151 -0.243173382941401 0.0655677564509993 0.128617894358182 -0.239754301727538 0.232261438099489
    "LEAHY (D VT)" -0.278228631055282 0.0242197320834283 -0.318712365969545 -0.233312853337711 0.133626722170454 0.140667199725057 -0.196102387197915 0.327966333238791
    "BRADLEY (D NJ)" -0.2687891291404 0.0372292599906854 -0.34338883785068 -0.212426521465655 0.133983415495429 0.148137742196440 -0.208814831985836 0.316199513349761
    "WYDEN (D OR)" -0.262749801308506 0.0352989788942549 -0.338478559431215 -0.20472803319104 0.158396700612318 0.117874463328492 -0.179640399463978 0.289791606068176
    "BUMPERS (D AR)" -0.248056526814670 0.0277129649547166 -0.299686228695726 -0.197011398230777 0.158493155818312 0.123560072575917 -0.0506108179985641 0.351729320653705
    "HARKIN (D IA)" -0.238253976611633 0.0275249732359982 -0.293964926792670 -0.195248764412594 0.186563163052933 0.12693487460437 -0.120009075633594 0.347638133753076
       etc etc etc
    "FRAHM (R KS)" 0.766908851376082 0.0914597767683575 0.625613721844755 0.995767876198796 0.884217278931857 0.0346438807423753 0.825733929805528 0.939558007655075
    "GRAMS (R MN)" 0.791347098723283 0.0477253007557132 0.71634114456152 0.880933318740965 0.884813385120334 0.0421023087915531 0.803962514533159 0.955092359822156
    "CRAIG (R ID)" 0.798569928508595 0.0603779523988627 0.686396244569486 0.904833048923472 0.885079470561768 0.0431467972157105 0.822699635709227 0.966064058350966
    "SMITH (R NH)" 0.802499888451778 0.0513193157417154 0.716851754946009 0.925461558800786 0.912400304311904 0.0405870462972340 0.838550659158186 0.983823578538827
    "NICKLES (R OK)" 0.8335948908007 0.0575166681661147 0.727504273119044 0.932150135470632 0.925334246662931 0.0336147422147895 0.85459187826742 0.990052064825521
    "LOTT (R MS)" 0.853784114475831 0.065939314911153 0.730990606385782 0.963198220874198 0.997291932953773 0.0419548014538604 0.920628647824988 1.08037789654150
    "GRAMM (R TX)" 0.86013895409139 0.0668803296244975 0.738998517814595 0.97008601182628 0.999999789596138 1.03578860019596e-06 0.999998137477307 1.00000173009050
    "FAIRCLOTH (R NC)" 0.86252291694481 0.0567373830206778 0.768024687410519 0.961100374980722 1.02645399349467 0.0353485051731512 0.96443002306122 1.08829681071493
    "KYL (R AZ)" 0.883698240027533 0.0630942336077122 0.764946860485221 0.985277044853578 1.03245451005413 0.0339143848527236 0.965660582029468 1.08458424882910
    "ASHCROFT (R MO)" 0.915040422271441 0.0643874036969359 0.794567281109498 1.01229236702003 1.04490958135752 0.0382750673903569 0.978104642690763 1.10988670510648
    "INHOFE (R OK)" 0.928389308174792 0.0573905230541822 0.80030925984812 1.02084814814722 1.05530391032868 0.0312415099933454 0.99815742379895 1.11641203947666
    "HELMS (R NC)" 1.00000024914177 1.25416859032160e-06 0.999997894925816 1.00000274933716 1.06649515550879 0.0436530264192146 0.99576718594392 1.14556022956397
    
    The first and fifth columns of numbers are the Posterior Means for the first and second dimensions.

    1. Write an Epsilon macro 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 might want to use the SPACE bar in the macro).

    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.

    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. Compare the two-dimensional coordinates from IDEAL with those you estimated using Optimal Classification in Problem 1.c 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 2.g of Homework 7. Report the Pearson r-squares before and after rotating.

    5. 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 5. 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,28X,I1,37X,A2,3I2,411X,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       120X,I2,7X,I2,687X,I1,20X,I1,63X,33I3)
    The format statement I used to write the data file is:
      200 FORMAT(1X,2I4,1X,I1,1X,A2,4I2,1X,14I3,1X,I2,5I1,1X,I1,1X,
         C       I2,5I1,I2,5I1,I2,5I1,I2,5I1,I2,5I1,1X,I2,1X,I1,1X,
         C       I2,1X,I2,1X,I1,1X,I1,1X,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 South/Non-South (1=Southern State, 0=Non-Southern State)
     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 5.

    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 5.

  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 5). 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.f of Homework 6.

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