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.

POLS 6386 MEASUREMENT THEORY
Third Assignment
Due 11 February 2003


  1. The aim of this problem is to show you how to use R to simulate a complex model of stimulus evaluation. The idea is that people use a simple mental model to compare two stimuli. The distinguishing features of the stimuli are assumed to be represented by dimensions in a simple geometric model. The stimuli are positioned on the dimensions according to the levels of the attributes represented by the dimensions. People are assumed to perceive the stimuli correctly with some random error. When asked to perform a stimulus comparison, people draw a momentary psychological value from a very tight error distribution around the locations of each of the stimuli. Their judgement of similarity is assumed to be an exponential function of the psychological distance between the two stimuli -- e-kd -- where d is the distance between the two momentary psychological values expressed as points in psychological space, and k is a scaling constant (see the figure below).



    What we are going to do is use a program to simulate this process and numerically compute the
    expected value of e-kd for 40 values of the true distance (from 0 to 2) between the true locations of the stimuli.

    Use Epsilon to type in the code below exactly as you see it below!
    
    STDDEVX <- .2; STDDEVY <- .2; XMEAN <- 0;YMEAN <- 0;m <- 1000;x <- NULL;y <- NULL; n <- 40;z <- NULL  This Line Initializes The Variables
    while (length(y) <= n) {                       ****Start of Outer Loop -- it Executes Until y has 40 Entries
       x <- 0                                      Initialize x to zero
       i <- 0                                      Initialize i to zero
       while (i <= m) {                                 ****Start of Inner Loop -- it Executes 1000 Times
           x.val <- c(rnorm(2,XMEAN,STDDEVX))           Draw two numbers randomly from Normal Distribution with Mean XMEAN and stnd. dev. of STDDEV and put them in the vector x.val
           y.val <- c(rnorm(2,YMEAN,STDDEVY))           Draw two numbers randomly from Normal Distribution with Mean YMEAN and stnd. dev. of STDDEV and put them in the vector y.val
           z.val <- sqrt((x.val[1]-y.val[1])**2 + (x.val[2]-y.val[2])**2) Calculate Euclidean Distance Between x.val and y.val
           z.val <- exp(-z.val)                         Calculate Exponential for -(distance)
           x <- x + z.val/m                             Store exp(-d) in x -- note the division by m so that x will contain the mean after m=1000 trials
           i <- i + 1                                   Increase i by 1 -- this is our counter
       }                                                ****End of Inner Loop
        y <- c(y,x)                                Store the Mean of exp(-d) Corresponding to YMEAN
        z <- c(z,sqrt(2*YMEAN^2))                  Store the current value of YMEAN
        YMEAN <- YMEAN + .05                       Increment YMEAN by .05
    }                                              ****End of Outer Loop
    
    Call the file Normal_1.R and load it into R as you did the Gill_1.R program you worked with for part 3 of the first homework. To run the program type:

    run <- Normal_1

    This runs the program in the background and generates the two vectors of numbers, y, the mean of the e-kd, and z the true distance between the two stimuli.

    1. Produce a plot of z versus y. Use the commands:

      plot(z,y,xlab="True Distance Between Stimuli",ylab="Observed Similarity",pch=16)
      title(main="Test of Shepard-Ennis-Nofosky, .2, .2")

      The "xlab" and "ylab" allow you to put proper titles on the dimensions and "pch=16" tells R to use solid dots in its plotting. The "title" command inserts the title. You should see something like this:



      Turn in this plot.

    2. Use Epsilon to change STDDEVX and STDDEVY in Normal_1.R, re-load it into R, and produce a plot like the above. For example, change STDDEVX to .1 and STDDEVY to .4 and re-run the program. Change the "title" each time to reflect the different values! Pick 3 pairs of reasonable values of STDDEVX and STDDEVY and produce plots for each experiment.


  2. The aim of this problem is to show you how to use KYST to estimate coordinates for the members of Congress by analyzing the agreement score matrix computed from the roll calls. To do this you need to run a program that creates the agreement scores from the roll call data and then you need to use Epsilon to paste the agreement score matrix into a file that KYST understands. Download the agreement score matrix program, the 107th Senate roll call data, and the "control card" file:

    Agreement Score Program

    107th Senate Roll Call Data

    Control Card File for Agreement Score Program

    and place them in the same folder on a WINTEL machine. SYMSTRT.DAT looks like this:
    
    SEN107KH.ORD
    SEN107.DAT
     633
    The first line is the name of the roll call matrix that the program will read and compute the agreement scores from. The second line is the name of the output file (its a good idea to name the output file something that you can remember!). And the third line is the number of roll call votes. Note that this number is always 4 digits -- in this case, 0672! So if you analyze a matrix with 1122 roll calls, the third line would be 1122. If there were only 99 roll calls, the third line would be 0099.

    1. At the command line type

      HOUSYM2

      The program should only take a few seconds to run and it produces two output files -- SEN107.DAT that you specified in the "control card" file, and a diagnostics file HOUSYM2.DAT. For example, below is the corresponding output files for the 105th Senate
      *********SEN105.DAT**********
      1059990999 0USA     10000CLINTON     100
      1054970041 0ALABAMA 20001SESSIONS     49100
      1059465941 0ALABAMA 20001SHELBY       47 89100
      1051490781 0ALASKA  20001MURKOWSKI    56 87 87100
      1051210981 0ALASKA  20001STEVENS      64 80 82 88100
      1051542961 0ARIZONA 20001KYL          47 90 85 85 77100
      1051503961 0ARIZONA 20001MCCAIN       62 82 81 83 79 87100
      1051430042 0ARKANSA 10001BUMPERS      83 35 41 41 48 34 43100
      1052930642 0ARKANSA 20001HUTCHINSON,  47 91 87 87 79 89 82 39100
      1051501171 0CALIFOR 10001BOXER        88 38 46 46 52 36 47 86 39100
      1054930071 0CALIFOR 10001FEINSTEIN    87 44 51 52 58 41 51 83 45 90100
      1052910862 0COLORAD 20001ALLARD       44 91 87 87 79 90 83 37 87 40 45100
      1059540762 0COLORAD 20001CAMPBELL     60 82 83 86 86 80 77 45 81 51 57 81100
      10514213 1 0CONNECT 10001DODD         92 43 47 50 56 42 51 84 44 89 89 44 53100
      10515704 1 0CONNECT 10001LIEBERMAN    88 49 53 57 63 49 59 78 50 82 86 50 58 88100
      1051410111 0DELAWAR 10001BIDEN        87 42 49 53 57 41 53 81 44 84 87 44 55 85 84100
      1051104411 0DELAWAR 20001ROTH, WILLI  66 78 82 87 85 78 81 48 79 53 59 79 82 57 63 60100
      1051550343 0FLORIDA 10001GRAHAM, BOB  84 49 53 56 59 47 55 79 50 79 82 48 57 83 82 82 63100
      1051503743 0FLORIDA 20001MACK         60 86 85 88 84 86 83 41 85 48 53 86 85 52 58 52 83 58100
      1054970144 0GEORGIA 10001CLELAND      86 43 49 52 56 41 51 82 43 83 84 45 52 83 81 84 58 83 52100
      1054930144 0GEORGIA 20001COVERDELL    52 89 89 90 83 87 84 39 89 46 50 87 85 49 55 50 82 53 88 51100
      1051440082 0HAWAII  10001AKAKA        87 37 44 48 51 36 46 86 39 89 86 39 50 88 83 87 52 83 47 88 46100
      105 481282 0HAWAII  10001INOUYE       85 42 48 51 58 40 50 83 42 86 85 43 54 87 82 85 56 81 51 88 49 93100
      1051480963 0IDAHO   20001CRAIG        46 89 87 90 83 87 81 39 89 43 48 89 86 46 52 48 82 51 87 47 90 42 46100
      1054930263 0IDAHO   20001KEMPTHORNE   50 90 87 89 83 86 82 40 90 44 49 89 86 47 52 48 82 52 86 47 89 42 46 96100
      1051502121 0ILLINOI 10001DURBIN       90 36 42 44 49 34 44 87 38 92 87 37 48 88 81 85 51 80 45 84 43 91 86 40 40100
      1054930321 0ILLINOI 10001MOSELEY-BRA  83 41 47 49 53 39 48 83 43 88 85 42 52 86 80 84 57 84 49 81 48 87 82 45 46 89100
      1051480622 0INDIANA 20001COATS        51 86 82 84 81 86 81 42 86 44 50 86 81 49 54 49 80 52 85 48 85 44 47 84 85 42 46100
      1051450622 0INDIANA 20001LUGAR        61 80 82 87 85 80 80 47 81 50 55 82 81 55 61 56 85 58 86 54 83 50 55 83 84 48 52 84100
      1051422631 0IOWA    20001GRASSLEY     54 86 84 89 83 83 80 43 85 48 51 86 83 50 57 52 83 54 85 50 87 46 50 87 87 46 50 82 83100
      1051423031 0IOWA    10001HARKIN       84 34 40 42 48 32 42 87 39 88 84 35 46 84 77 83 49 80 43 81 41 88 85 39 40 89 86 41 47 44100
      1052952332 0KANSAS  20001BROWNBACK    50 90 87 88 78 88 84 36 90 40 47 91 81 46 51 46 81 51 87 45 88 41 44 89 90 40 45 85 83 87 37100
      1051485232 0KANSAS  20001ROBERTS      53 88 86 90 85 83 81 42 87 44 51 87 84 49 54 50 83 54 86 51 87 45 49 89 89 43 48 85 87 87 41 89100
      1051430251 0KENTUCK 10001FORD, WENDE  78 47 51 54 58 44 50 78 47 82 81 46 57 80 77 80 57 79 54 83 52 84 86 49 49 82 79 51 55 52 79 47 52100
      1051492151 0KENTUCK 20001MCCONNELL    53 90 89 91 85 89 84 38 90 43 49 89 86 48 54 48 84 53 89 48 92 44 47 90 90 40 45 87 85 87 39 89 88 52100
      1051305645 0LOUISIA 10001BREAUX       81 54 59 62 64 52 59 73 55 77 82 55 63 79 81 80 65 82 62 81 59 78 80 57 58 75 75 56 62 59 72 54 60 83 59100
      1054970245 0LOUISIA 10001LANDRIEU     84 46 51 55 59 45 54 82 48 84 87 48 58 87 84 85 60 85 55 85 52 86 86 50 51 84 82 51 57 54 82 49 53 84 52 87100
      10549703 2 0MAINE   20001COLLINS      73 73 75 78 81 71 78 57 73 62 65 72 78 66 70 64 81 67 80 63 79 60 62 75 77 60 63 77 80 78 57 74 77 60 76 66 65100
      10514661 2 0MAINE   20001SNOWE        69 72 74 76 80 69 76 57 73 62 65 71 76 66 70 65 78 68 77 63 77 61 63 74 75 61 65 73 77 76 58 72 75 61 74 66 65 92100
      1051444052 0MARYLAN 10001MIKULSKI     91 39 45 45 51 37 47 85 40 90 88 40 52 90 84 85 54 83 48 86 46 91 89 42 43 90 87 45 50 46 88 42 45 84 44 78 86 61 62100
      1051303952 0MARYLAN 10001SARBANES     89 35 42 43 49 34 43 88 37 90 87 37 48 89 82 85 50 83 44 87 43 92 89 39 40 92 87 42 47 44 89 38 43 83 41 76 85 59 60 94100
      10510808 3 0MASSACH 10001KENNEDY, ED  90 32 40 41 47 33 43 88 36 89 85 34 45 87 80 84 49 80 42 84 40 92 87 36 37 92 86 41 47 42 89 36 40 81 38 74 83 58 59 91 94100
      10514920 3 0MASSACH 10001KERRY, JOHN  89 37 44 46 51 37 47 88 40 91 89 40 49 91 85 86 54 82 47 83 44 91 88 41 42 91 88 46 50 47 88 41 43 82 43 78 86 61 61 90 92 92100
      1054950023 0MICHIGA 20001ABRAHAM      55 88 87 89 82 88 86 43 88 47 51 87 83 52 56 50 84 54 88 50 91 45 49 89 89 44 49 86 86 87 42 88 87 51 90 59 53 79 77 47 43 42 46100
      1051470923 0MICHIGA 10001LEVIN, CARL  90 39 45 45 51 37 46 87 40 88 86 38 48 88 83 85 51 84 47 86 43 92 89 40 42 89 86 45 51 46 87 39 43 82 42 77 85 61 62 91 93 91 90 45100
      1052936733 0MINNESO 20001GRAMS        48 89 86 88 81 87 82 38 88 41 47 90 80 46 51 45 81 49 84 45 88 41 45 89 88 39 43 86 83 86 37 91 87 47 90 54 48 73 70 41 38 37 42 87 39100
      1054910133 0MINNESO 10001WELLSTONE    79 31 36 35 41 30 40 87 33 85 79 32 42 81 74 78 44 74 37 78 36 84 80 33 35 86 81 37 42 39 89 32 36 76 32 69 76 53 54 85 88 88 86 38 85 34100
      1051400946 0MISSISS 20001COCHRAN      61 83 85 89 89 81 81 46 82 50 55 82 84 53 60 56 89 60 87 56 85 50 55 85 85 47 52 82 89 84 46 83 87 58 87 66 59 79 76 50 47 44 49 84 49 83 38100
      1051403146 0MISSISS 20001LOTT         52 90 90 91 86 87 82 40 90 44 50 89 86 48 54 49 85 55 91 49 91 44 48 91 90 42 47 86 86 88 40 89 90 54 94 61 53 78 75 45 42 39 44 90 43 88 33 91100
      1054950134 0MISSOUR 20001ASHCROFT     40 91 84 84 75 89 81 35 91 36 41 90 79 39 45 40 76 46 83 39 86 35 38 89 89 33 39 85 79 84 33 89 84 43 87 50 44 69 69 35 33 31 36 86 35 89 32 79 87100
      1051550134 0MISSOUR 20001BOND         52 84 86 89 83 81 81 45 84 49 56 84 84 53 58 55 83 58 84 54 87 50 52 88 89 47 53 81 85 85 45 86 88 54 86 64 58 80 78 50 47 44 48 87 48 85 39 85 87 82100
      1051420364 0MONTANA 10001BAUCUS       85 48 53 56 61 46 53 80 50 81 83 51 58 83 80 81 62 85 56 84 53 85 84 52 53 81 84 52 60 57 81 51 55 80 53 83 84 66 67 83 82 81 83 55 83 51 75 60 55 46 59100
      1051570164 0MONTANA 20001BURNS        52 89 88 90 85 87 81 40 88 45 50 87 85 49 54 49 83 53 86 49 89 45 48 92 92 42 47 85 84 88 40 88 89 52 90 58 52 76 76 45 42 39 43 89 43 88 34 87 90 84 87 55100
      1054970435 0NEBRASK 20001HAGEL        55 86 86 89 86 84 81 41 84 45 51 86 82 51 56 51 85 56 87 52 86 46 51 87 87 44 49 85 88 86 42 86 89 53 89 60 54 77 74 47 44 41 45 86 45 88 35 90 91 82 85 57 89100
      1051570235 0NEBRASK 10001KERREY, BOB  88 44 49 53 57 43 52 81 46 82 84 46 55 86 81 83 59 83 52 83 49 85 85 48 49 83 84 51 57 53 81 47 51 79 49 80 86 64 65 85 85 83 85 51 83 48 78 57 50 42 56 87 50 53100
      1051570065 0NEVADA  10001BRYAN, RICH  86 45 50 53 57 45 55 82 48 83 82 48 56 81 80 81 60 85 53 81 50 83 83 49 50 82 85 50 56 54 81 48 51 78 49 81 85 64 64 84 82 82 85 53 82 49 78 58 51 45 55 87 51 52 85100
      1051505465 0NEVADA  10001REID         80 47 51 53 56 45 54 80 48 85 83 47 58 81 78 83 59 80 53 80 52 83 82 50 51 81 84 50 55 54 82 49 51 81 49 79 82 64 64 85 83 82 84 53 82 49 78 57 51 45 56 82 52 52 80 88100
      10514826 4 0NEW HAM 20001GREGG        54 85 84 86 82 85 83 43 84 46 52 86 81 52 59 52 85 56 84 49 85 45 47 87 86 44 49 85 83 84 42 86 85 51 87 56 52 79 77 47 43 42 47 87 44 86 36 84 88 83 84 53 85 85 52 51 51100
      10515116 4 0NEW HAM 20001SMITH, ROBE  40 91 85 84 77 90 81 34 90 36 41 90 80 41 47 40 76 47 83 38 86 35 39 88 88 35 41 85 78 82 33 89 85 44 86 49 42 71 71 37 34 32 36 85 37 86 31 79 85 92 81 45 86 83 40 43 45 85100
      1051491412 0NEW JER 10001LAUTENBERG   87 37 44 45 50 37 47 87 39 90 86 39 50 89 84 85 52 81 47 84 46 91 86 40 41 91 87 44 49 46 86 40 43 82 42 77 85 62 63 90 91 91 92 46 89 39 85 48 43 35 48 83 43 45 83 84 84 47 37100
      1051507112 0NEW JER 10001TORRICELLI   82 42 50 50 55 41 50 85 46 88 88 43 55 84 84 84 56 80 51 82 49 86 84 46 46 86 84 49 51 49 84 45 47 79 47 77 83 63 64 88 87 85 88 50 85 45 82 53 48 41 52 80 48 49 81 81 83 51 43 87100
      1051491266 0NEW MEX 10001BINGAMAN     88 41 46 50 54 40 49 85 43 85 84 43 52 86 80 83 55 81 50 84 48 87 86 45 46 85 84 45 54 49 84 45 50 80 46 80 85 62 62 86 87 86 88 49 85 44 81 54 47 40 53 85 47 49 85 84 84 47 40 86 84100
      1051410366 0NEW MEX 20001DOMENICI     63 82 83 90 90 80 81 47 81 52 57 83 85 56 63 58 86 59 85 56 85 52 56 86 87 50 54 83 88 85 47 83 88 57 87 65 60 83 79 52 49 47 51 86 50 84 41 90 88 78 88 61 88 88 58 57 58 83 79 50 54 55100
      1051490013 0NEW YOR 20001D'AMATO      59 70 75 79 80 70 73 56 72 62 65 72 80 64 68 66 80 65 76 63 79 61 63 75 76 59 64 74 78 79 57 74 76 62 76 66 64 81 78 62 59 57 61 78 60 72 53 79 78 68 80 65 76 76 62 63 66 76 69 60 63 62 82100
      1051450813 0NEW YOR 10001MOYNIHAN     80 43 49 53 58 42 52 84 46 81 83 46 56 83 79 83 59 81 51 81 47 83 84 49 49 83 82 50 57 52 80 47 51 78 48 80 85 61 62 83 84 83 85 50 83 47 79 56 50 43 55 84 50 52 86 83 80 50 42 83 82 81 58 62100
      1054930447 0NORTH C 20001FAIRCLOTH    42 88 83 84 76 84 77 35 86 40 44 86 81 42 48 43 75 47 81 42 85 38 41 86 85 36 42 81 77 80 35 83 81 47 87 53 45 68 67 40 37 34 39 83 38 84 31 78 86 88 80 45 84 81 42 44 45 82 88 37 43 40 77 71 44100
      1051410547 0NORTH C 20001HELMS        43 93 85 85 78 87 77 34 88 38 43 88 81 41 48 42 77 48 84 41 86 37 41 86 86 35 40 84 78 82 34 86 84 48 90 54 45 69 69 38 36 33 37 84 38 87 31 80 89 89 82 47 86 84 42 44 45 84 90 36 42 40 80 70 43 92100
      1051550236 0NORTH D 10001CONRAD       78 44 50 51 54 41 48 85 46 83 83 44 54 82 78 81 55 83 49 85 48 86 85 48 49 83 82 48 53 50 83 45 51 84 48 81 84 59 61 84 86 83 83 49 84 45 80 54 48 43 54 84 50 49 84 84 83 48 42 84 83 84 54 61 85 43 43100
      1051481236 0NORTH D 10001DORGAN       78 43 49 50 54 39 48 85 44 85 83 43 53 83 77 82 53 80 49 85 48 86 86 47 48 85 82 46 53 49 85 44 50 83 45 78 83 60 63 85 87 84 83 48 84 44 82 52 46 41 54 83 49 49 81 83 86 47 40 85 83 85 54 62 82 41 42 94100
      1051502024 0OHIO    20001DEWINE       60 81 83 87 84 81 82 48 81 52 57 81 81 57 62 57 85 60 87 55 85 53 56 85 85 50 53 84 88 85 49 84 85 55 86 61 59 80 77 53 50 48 53 87 51 82 44 87 87 79 84 59 86 85 58 57 58 84 79 51 55 54 87 83 56 78 79 54 52100
      1051430424 0OHIO    10001GLENN        89 38 44 46 51 38 48 88 40 87 87 40 48 88 83 84 53 83 47 84 44 90 88 41 42 88 84 45 51 46 85 41 44 82 44 78 86 60 60 89 90 89 90 46 91 42 83 50 44 35 47 82 43 46 84 83 82 46 36 88 86 85 50 58 84 36 36 83 83 53100
      1051542453 0OKLAHOM 20001INHOFE       39 93 87 85 78 89 79 34 91 36 43 90 82 40 47 40 76 47 85 40 87 36 40 89 89 35 38 85 79 83 33 88 86 46 89 52 45 70 70 38 35 32 35 85 37 87 30 81 89 92 82 45 87 84 42 43 45 83 93 34 41 39 80 69 43 87 91 43 42 80 35100
      1051490853 0OKLAHOM 20001NICKLES, DO  48 92 87 88 80 90 82 36 90 39 45 91 81 43 50 44 81 49 86 44 88 38 42 89 88 37 42 85 82 87 34 89 87 47 89 55 47 73 71 39 36 34 39 87 38 89 29 83 90 90 84 48 86 87 45 46 47 88 90 38 42 43 82 72 45 87 90 44 43 81 38 92100
      1054970572 0OREGON  20001SMITH, GORD  61 82 84 89 87 80 82 48 82 52 57 83 84 56 63 58 87 60 86 56 85 52 56 85 86 49 55 84 91 85 48 83 87 55 87 64 59 81 79 52 49 47 53 87 51 84 42 89 88 78 87 62 87 86 58 58 58 85 79 51 55 55 91 81 57 77 79 56 54 88 52 79 82100
      1051487172 0OREGON  10001WYDEN        81 41 47 48 54 41 51 85 46 87 84 43 52 85 80 82 55 80 50 80 49 85 83 47 48 86 86 49 51 51 87 44 48 77 46 74 82 64 65 84 83 84 86 50 82 44 82 51 47 42 52 82 47 46 82 83 83 51 41 86 84 83 52 63 79 42 40 82 84 55 83 41 43 55100
      1052914114 0PENNSYL 20001SANTORUM     55 87 84 87 83 85 82 41 84 46 52 86 83 50 56 50 82 55 86 50 86 45 48 87 87 45 49 84 83 87 42 87 85 52 87 58 52 79 76 46 43 42 46 88 46 86 36 84 87 84 85 55 87 86 51 51 53 87 85 45 49 48 86 76 50 81 83 49 48 84 46 84 86 85 49100
      1051491014 0PENNSYL 20001SPECTER      68 64 67 70 74 62 70 65 64 70 72 63 72 70 72 69 71 70 70 67 68 67 67 66 67 68 69 66 72 68 66 63 68 67 66 69 70 80 81 69 68 67 68 69 69 63 63 70 67 62 71 70 67 66 67 68 70 67 63 68 69 67 72 78 69 62 61 68 69 72 64 63 63 73 71 69100
      10514500 5 0RHODE I 20001CHAFEE       77 68 70 77 80 67 73 60 69 64 69 69 75 68 71 68 80 69 75 65 73 64 65 72 73 62 65 71 80 74 60 70 75 62 73 67 70 83 82 63 61 61 64 74 64 69 55 77 75 65 76 69 73 74 69 67 63 74 65 64 63 66 80 75 67 63 66 62 61 77 65 66 68 80 65 71 76100
      10529142 5 0RHODE I 10001REED         86 35 42 44 50 35 44 88 38 89 86 38 48 87 82 84 51 81 45 85 42 92 89 40 40 91 86 43 50 45 89 39 44 83 41 76 85 60 62 90 92 94 92 45 91 39 87 48 42 35 47 83 42 44 84 83 85 44 35 90 87 87 49 58 85 36 35 85 87 50 90 35 36 50 85 43 67 63100
      1051120448 0SOUTH C 10001HOLLINGS     73 47 52 50 57 46 53 78 48 77 78 47 55 77 73 75 55 77 50 77 49 80 81 48 48 76 77 50 52 49 78 46 49 81 50 75 78 61 62 80 80 79 78 51 81 48 76 55 50 46 52 77 50 51 76 77 79 52 46 78 77 78 54 59 78 49 49 83 82 54 79 46 47 53 76 51 68 60 80100
      105 936948 0SOUTH C 20001THURMOND     53 89 88 89 85 86 83 40 89 43 50 86 85 47 54 49 83 55 90 49 90 44 48 89 89 42 45 84 86 86 41 88 89 53 92 60 53 75 75 44 42 40 44 88 44 88 34 87 92 86 87 52 89 87 49 50 52 85 85 41 47 47 86 74 49 85 88 48 47 85 43 88 88 85 47 85 68 73 42 51100
      1051461737 0SOUTH D 10001DASCHLE      90 40 46 49 54 38 49 85 42 88 86 42 52 88 83 87 55 81 49 87 47 90 91 45 46 88 84 46 53 49 87 43 48 86 46 82 89 61 61 89 89 87 89 49 88 43 82 53 47 37 52 87 46 49 87 84 86 46 36 89 84 88 56 62 84 39 39 87 89 54 86 38 41 55 83 47 67 64 89 79 47100
      1051542537 0SOUTH D 10001JOHNSON      85 39 46 48 52 39 50 86 43 86 83 42 50 86 80 85 55 82 48 85 46 88 85 43 45 87 84 45 54 49 87 44 47 81 45 77 83 62 62 88 88 87 87 50 87 44 84 52 45 39 52 82 46 48 83 83 83 48 37 88 83 84 54 62 81 39 38 87 88 53 84 38 41 53 83 47 70 62 87 79 46 91100
      1054950254 0TENNESS 20001FRIST        57 87 88 90 87 84 84 43 86 48 53 85 83 52 59 53 87 57 87 52 90 48 51 89 89 45 51 85 86 87 43 88 88 55 91 61 55 81 79 48 45 42 47 89 45 87 37 88 91 83 88 56 89 88 53 53 54 89 83 48 50 49 87 80 52 82 85 50 50 88 48 84 86 88 51 87 69 77 45 53 88 51 48100
      1054950354 0TENNESS 20001THOMPSON     55 86 85 83 80 86 85 41 85 44 50 87 80 48 56 49 81 55 87 50 85 44 48 84 85 42 46 83 81 81 39 85 82 52 86 58 52 77 75 46 42 41 45 84 43 85 37 83 87 84 81 53 83 84 50 52 52 85 85 45 49 47 81 72 51 82 83 49 47 83 46 86 86 81 48 82 67 71 43 53 86 47 47 86100
      1051462849 0TEXAS   20001GRAMM, PHIL  48 91 86 87 78 91 83 35 88 38 44 91 79 43 49 43 80 47 84 43 86 37 40 88 87 37 41 85 80 85 34 89 86 45 88 53 46 71 69 38 36 33 38 86 38 90 31 82 88 90 83 47 86 85 45 46 46 86 89 36 40 40 81 71 44 86 89 42 41 80 37 89 90 82 41 86 61 69 35 45 87 40 41 85 85100
      1054930649 0TEXAS   20001HUTCHISON,   55 88 87 89 82 85 83 41 88 45 52 86 84 48 55 50 82 54 86 48 89 44 46 89 89 43 46 82 82 87 41 87 88 49 88 58 51 77 75 45 42 39 43 88 43 86 36 84 89 85 87 52 88 85 49 50 51 86 84 43 48 48 85 76 47 83 85 48 48 84 43 88 87 84 47 86 69 72 42 49 88 47 47 88 83 87100
      1054930767 0UTAH    20001BENNETT      58 83 85 90 87 82 81 45 83 48 55 82 87 53 60 55 88 60 87 55 86 50 54 87 87 47 52 81 85 86 46 84 88 57 88 65 58 80 77 50 47 45 50 86 48 83 39 90 90 79 88 59 88 87 56 56 56 85 80 49 52 52 90 81 55 79 81 54 52 86 49 82 83 90 51 84 71 78 48 53 88 53 52 87 81 82 87100
      1051450367 0UTAH    20001HATCH        58 84 85 90 87 82 82 46 83 49 55 84 85 54 60 55 86 59 87 54 86 51 54 88 88 48 52 85 86 86 46 86 88 56 89 64 57 80 77 50 48 45 51 88 48 85 39 88 90 81 87 59 88 87 55 56 57 85 81 49 54 53 91 80 55 80 83 54 52 89 50 83 85 91 52 86 72 77 48 54 88 53 52 88 82 82 86 92100
      10514240 6 0VERMONT 20001JEFFORDS     75 63 65 71 76 60 66 64 66 67 71 63 72 68 70 68 75 71 69 65 67 67 66 67 68 65 68 67 73 71 66 64 69 64 68 67 68 79 79 67 65 65 68 68 65 65 60 73 69 62 72 71 69 70 69 69 67 69 60 66 66 67 75 75 70 60 62 67 65 74 65 61 63 74 70 67 81 84 65 65 68 67 67 71 65 62 69 73 72100
      10514307 6 0VERMONT 10001LEAHY        83 41 47 48 54 40 49 83 44 87 85 42 52 86 81 84 55 80 49 81 48 87 83 45 46 86 84 46 52 50 86 44 47 79 46 78 84 63 64 86 87 87 87 49 86 43 82 52 46 40 52 83 47 48 85 83 83 49 40 89 84 85 53 62 81 39 39 84 85 53 82 40 42 54 86 48 71 64 86 78 45 88 87 51 47 41 47 52 51 71100
      1051570540 0VIRGINI 10001ROBB         86 48 52 56 60 48 57 78 49 79 82 50 56 83 81 81 62 83 56 79 52 81 82 51 52 78 81 54 59 54 78 50 52 78 52 77 82 66 66 81 80 79 83 55 82 51 72 60 53 46 56 81 54 55 82 82 79 55 46 80 78 79 61 64 78 47 47 78 76 60 84 45 49 59 80 55 68 69 81 78 53 82 80 57 55 48 54 56 58 70 80100
      1051471240 0VIRGINI 20001WARNER       54 83 84 88 86 82 81 45 85 46 52 84 83 51 59 52 84 56 83 52 85 48 52 87 88 44 49 83 86 85 46 84 87 53 87 60 55 77 76 48 45 44 47 86 47 84 39 87 86 82 86 58 86 86 54 53 53 84 82 46 51 50 87 78 54 80 81 53 52 84 46 83 84 88 53 84 72 76 46 52 87 51 51 87 81 82 88 86 87 73 51 58100
      1051490473 0WASHING 20001GORTON       60 84 84 87 86 79 80 47 79 49 55 82 81 53 61 55 86 58 84 55 83 49 54 83 83 46 52 82 86 83 46 82 86 56 85 63 58 79 75 51 47 46 48 84 50 80 40 89 87 76 84 58 84 86 55 56 55 82 78 49 51 51 88 76 55 75 78 53 53 84 51 80 81 87 50 82 70 78 48 54 83 53 52 87 81 81 84 88 88 70 51 58 84100
      1054930873 0WASHING 10001MURRAY       84 40 47 48 54 39 48 86 42 90 87 42 51 89 83 83 55 82 49 86 48 90 86 45 46 88 87 46 51 48 87 43 47 81 46 75 84 64 64 89 90 88 90 49 89 42 83 51 46 38 52 84 47 48 84 81 83 49 39 89 87 88 54 64 81 40 39 84 85 55 87 38 40 54 88 48 71 65 89 79 45 88 87 50 46 39 47 51 52 70 89 80 49 51100
      105 136656 0WEST VI 10001BYRD, ROBER  79 47 50 53 56 44 51 77 48 78 78 45 54 77 74 76 56 75 50 76 51 78 78 48 48 79 75 49 55 52 76 47 51 73 49 73 74 61 64 78 80 79 76 50 78 48 75 54 49 44 55 73 50 51 75 74 76 51 45 77 78 75 55 59 78 46 45 79 80 54 76 45 47 56 73 53 64 62 77 73 50 77 78 52 49 45 50 54 55 63 76 71 53 56 75100
      1051492256 0WEST VI 10001ROCKEFELLER  89 40 46 49 54 39 50 84 42 86 86 41 51 87 84 85 56 84 49 85 48 88 86 43 44 88 85 46 53 49 84 44 48 82 46 80 85 63 64 89 88 88 89 48 86 44 82 52 47 36 52 84 46 49 87 84 82 49 38 88 85 84 53 61 84 38 38 84 83 54 87 38 41 55 83 48 67 65 89 75 46 89 87 51 48 39 48 53 54 67 87 82 50 53 87 80100
      1054930925 0WISCONS 10001FEINGOLD     84 41 42 41 46 39 45 80 42 80 77 40 46 77 73 75 49 73 45 75 42 79 76 41 41 83 80 43 45 47 81 41 42 74 38 68 76 59 60 81 81 81 79 44 81 40 82 45 41 40 45 76 40 42 78 78 77 46 40 81 76 77 45 54 74 38 37 78 78 47 81 38 41 46 79 46 62 57 80 75 40 78 78 44 45 40 42 44 44 60 79 74 43 45 78 72 78100
      1051570325 0WISCONS 10001KOHL         85 45 48 50 55 45 53 79 47 81 82 46 52 81 80 80 57 80 52 77 48 79 76 47 49 80 81 50 53 53 82 47 48 74 47 74 81 65 64 81 79 79 82 51 81 46 77 53 49 44 52 79 48 50 79 80 78 53 44 81 79 79 53 62 77 44 43 77 77 56 81 42 46 54 82 52 68 66 79 74 48 79 81 51 51 47 49 51 52 68 82 79 51 52 81 70 79 82100
      1054970668 0WYOMING 20001ENZI         45 91 88 90 82 88 81 38 88 41 47 91 83 44 51 46 81 50 86 46 88 41 45 89 89 39 45 87 83 88 38 89 89 49 90 56 49 74 73 42 39 37 41 88 40 90 33 84 90 88 86 51 91 89 48 48 50 86 88 39 44 44 84 73 48 86 89 47 46 82 39 90 89 85 44 88 66 71 41 48 89 44 43 88 84 89 87 86 86 66 44 50 85 84 42 50 44 40 46100
      1051563368 0WYOMING 20001THOMAS       52 89 86 89 82 88 83 40 89 42 48 91 82 47 52 47 82 51 87 47 87 42 46 90 91 41 46 87 86 86 39 89 88 48 89 56 50 76 73 43 40 38 43 89 42 91 34 85 89 87 86 53 90 89 49 51 50 87 87 41 45 45 86 74 49 84 87 47 47 83 41 88 88 86 46 88 66 72 41 49 89 45 45 87 84 90 87 85 87 67 45 53 86 83 44 49 45 41 48 93100
      
      *************HOUSYM2.DAT***************
      
      SEN105KH.ORD                                                    
      SEN105.DAT                                                      
       612
       NUMBER OF RECORDS READ   101
       ERROR PARAMETER EIGENVALUE-EIGENVECTOR ROUTINE=    0
       EIGENVALUES OF DECOMPOSITION
           1     6.17379     7.21315
           2     0.23954
           3     0.19360
           4     0.14825
           5     0.11191
           6     0.09071
           7     0.08423
           8     0.07443
           9     0.06973
          10     0.06571
          11     0.05776
          12     0.05354
          13     0.05087
          14     0.04732
          15     0.04492
          16     0.04059
          17     0.04042
          18     0.03738
          19     0.03612
          20     0.03420
                            14.53.47.89.
       ELAPSED TIME OF JOB  14.53.48.23.
      The first two lines of HOUSYM2.DAT echo back the first two lines of SYMSTRT.DAT. The third line tells you how many legislators there are in the file, the fourth is a "flag" that tells you if the eigenvalue-eigenvector decomposition of the double-centered agreement score matrix was successful ("0" is yes), and then the first 20 eigenvectors are listed. The extra number in the first row of the eigenvector listing is equal to the sum of the squared diagonal entries of the double-centered matrix.

      Turn in a copy of the HOUSYM2.DAT output file.

    2. Turn in a plot of the eigenvalues. Use either Excel or R to do the plot. For example, here is a plot of the eigenvalues for the 105th Senate.

    1. Use Epsilon to enter the following commands on top of your agreement score output file:
      
      TORSCA
      PRE-ITERATIONS=3
      DIMMAX=3,DIMMIN=1
      COORDINATES=ROTATE
      CARDS
      ITERATIONS=50
      REGRESSION=DESCENDING
      DATA,LOWERHALFMATRIX,DIAGONAL=PRESENT,CUTOFF=.01
      2001-2002 U. S. SENATE AGREEMENT SCORES
      103  1  1
      (37X,103F3.0)
      *********agreement score file*********
      COMPUTE
      STOP
      Be sure to put the COMPUTE and STOP lines on the bottom of the agreement score file.

      Run KYST on this file and report the STRESS values for one, two, and three dimensions.

    2. Download the 107th Senate W-NOMINATE scores from my website:

      107th Senate W-NOMINATE Scores

      Use Epsilon to merge the two and one dimensional coordinates from KYST into this file. Turn in a listing of the Epsilon macro that you used to create the combined file.

    3. Load the file into R. Use R to compute the correlations between the the W-NOMINATE first and second dimension scores with the corresponding first and second dimension coordinates from KYST. Also compute the correlation between the one dimensional KYST configuration with the first W-NOMINATE dimension. In R the command to compute a Pearson correlation between two variables is simply:

      cor(z,y)

      where z and y are the two variables.

    4. Use R to plot the first dimension of W-NOMINATE against the one dimensional KYST configuration. Label the axes and title the plot appropriately.

    5. Use R to produce plots of the two-dimensional W-NOMINATE coordinates and the two-dimensional KYST coordinates. Label the axes and title the plot appropriately.

    6. Use Epsilon to change your KYST commands on top of your agreement score output file so it looks like this:
      
      TORSCA
      PRINT HISTORY, PRINT DISTANCES
      PRE-ITERATIONS=3
      DIMMAX=2,DIMMIN=2
      COORDINATES=ROTATE
      CARDS
      ITERATIONS=50
      REGRESSION=DESCENDING
      DATA,LOWERHALFMATRIX,DIAGONAL=PRESENT,CUTOFF=.01
      2001-2002 U. S. SENATE AGREEMENT SCORES
      103  1  1
      (37X,103F3.0)
      *********agreement score file*********
      COMPUTE
      STOP
      With the "PRINT HISTORY, PRINT DISTANCES" we will get the "Dist" and "Dhat" output that we worked with in question 2 of Homework Two. Also note that we changed "DIMMAX=3,DIMMIN=1" to "DIMMAX=2,DIMMIN=2" so that all we will get is the two-dimensional results. Use Epsilon as described in question 2 of Homework Two to read "DATA", "DIST", and "DHAT" into Excel and make a plot of the estimated distances from KYST -- "DIST" -- on the horizontal axis against the agreement scores -- "DATA" -- on the vertical axis. Fit a line to the data as described in question 2 of Homework Two. Display the fitted equation and the corresponding r-square on the plot. Turn in the plot -- it should look something like this:



      Use Epsilon to put data labels on top of the "DATA", "DIST", and "DHAT" columns and the load the file into R. First read the file in:

      shepard <- read.table("E:/class2000/junk.txt",header=T)

      Now attach the table so R can use the columns:

      attach(shepard)

      Now, to make a plot that looks like the Excel plot, we use the plot command:
      
      plot(DIST,DATA,xlab="Distances From Estimated by KYST in Two Dimensions",ylab="Agreement Scores")
      This puts "DIST" on the horizontal axis, "DATA" on the vertical axis, and inserts the lables indicated after the xlab= and ylab= in the plot command. Turn in this graph.

      Now, to fit the line from Excel use the "lines" command in R; namely

      lines(DIST,92.89-46.665*DIST+39.479*DIST^2-18.667*DIST^3+2.5437*DIST^4,lwd=4)

      The first argument tells R to use the horizontal axis, the second argument tells R to graph a line with horizontal coordinates equal to "DIST" and vertical coordinates using the 4th degree polynomial in "DIST", and the last argument sets the line width (lwd) to wide so that we can see the graph. You should see something like the following:



      Put an appropriate title on the graph and turn it in.