POLS 6386 MEASUREMENT THEORY
Fourth Assignment
Due 18 February 2003


  1. Run Tables 1.1, 1.3, 1.4, and 4.1 from Borg and Groenen through KYST. Note that all four tables are similarities so that you can use the Supreme Court example as a template. (Note that you will have to enter the diagonals for tables 1.3 and 1.4 -- 9 and 7, respectively.) For example, for Table 4.1, if you entered the data as follows:
    
     434_INDIGO        100  86  42  42  18   6   7   4   2   7   9  12  13  16
     445_BLUE           86 100  50  44  22   9   7   7   2   4   7  11  13  14
     465                42  50 100  81  47  17  10   8   2   1   2   1   5   3
     472_BLUE-GREEN     42  44  81 100  54  25  10   9   2   1   0   1   2   4
     490                18  22  47  54 100  61  31  26   7   2   2   1   2   0
     504_GREEN           6   9  17  25  61 100  62  45  14   8   2   2   2   1
     537                 7   7  10  10  31  62 100  73  22  14   5   2   2   0
     555_YELLOW-GREEN    4   7   8   9  26  45  73 100  33  19   4   3   2   2
     584                 2   2   2   2   7  14  22  33 100  58  37  27  20  23
     600_YELLOW          7   4   1   1   2   8  14  19  58 100  74  50  41  28
     610                 9   7   2   0   2   2   5   4  37  74 100  76  62  55
     628_ORANGE-YELLOW  12  11   1   1   1   2   2   3  27  50  76 100  85  68
     651_ORANGE         13  13   5   2   2   2   2   2  20  41  62  85 100  76
     674_RED            16  14   3   4   0   1   0   2  23  28  55  68  76 100
    
    then change the format statement to:

    (18X,101F4.0)

    Be sure to change the missing values parameter to a negative number because there are some zeroes in the matrix. Your KYST file should look like the following:
    
    TORSCA
    PRE-ITERATIONS=3
    DIMMAX=3,DIMMIN=1
    PRINT HISTORY,PRINT DISTANCES
    COORDINATES=ROTATE
    ITERATIONS=50
    REGRESSION=DESCENDING
    DATA,LOWERHALFMATRIX,DIAGONAL=PRESENT,CUTOFF=-.01
    EKMAN'S COLOR DATA EXAMPLE
     14  1  1
    (18X,101F4.0)
    ****the color data****
    COMPUTE
    STOP
    1. Run all tables from 3 to 1 dimensions, report the Stress values, and use R to graph the results for each table in two dimensions.

    2. Produce Shepard Diagrams for each two dimensional solution (the horizontal axis is the actual similarities data -- the "DATA" column in the KYST output file -- and the vertical axis is the estimated distances -- the "DIST" column in the KYST output file).

  2. In this problem we are going to run a simple Epsilon macro that we create in advance! The macro takes the two-dimensional coordinates from the KYST output and combines them with the color row names from the file used in problem (1) above. Here is the macro:
    
    
    (define-macro "hw4" "C-U41C-FC-KC-YC-AC-NC-XoC-XoC-YC-AC-XpC-U19C-FC-MC-PC-KC-YC-DC-AC-NC-XoC-YC-AC-EC-MC-XpC-Xp")
    1. Read your coordinate file into R with the command:

      colornames <- read.csv("D:/r_files/color_coords.txt",header=T,row.names=1)

      then be sure to attach the file so you can work with the variables:

      attach(colornames)

      The ".csv" tells R that color_coords.txt is comma delimited! When you set up your coordinate files this way you do not need to use "_" in the labels. But be sure that in the column label line that you have commas separating the labels.

      Make a plot of the color coordinates. Set the axes so that you can see the labels and the plot looks nice (the "xlim" and "ylim" commands). You can suppress the "o"'s before the names by using the commands:

      plot(DIM.1,DIM.2,type="n",main="The Color Circle",xlim=c(-2,2),ylim=c(-2,2))
      text(DIM.1,DIM.2,labels=row.names(colornames),adj=0)

      The 'type="n"' suppresses the display of the "o"'s.

    2. Edit macro_hw4.txt so that you can use it to create the coordinate file for Table 1.3 -- the similarities for nations. Call the macro macro_hw4_2b.txt. Turn in this macro and the file that it creates.

  3. Below is a matrix of squared distances between 7 points in two dimensions. One of the points is at the origin and the other 6 are arranged symmetrically around it. Double Center the matrix and solve for the coordinates. Show all your computations.
    
                               1   2   3   4   5   6   7
                             ---------------------------
                           1 | 0   2   1   2   2   1   2
                             |            
                           2 | 2   0   1   4   8   5   4
                             |            
                           3 | 1   1   0   1   5   4   5
                             |                       
                           4 | 2   4   1   0   4   5   8
                             |
                           5 | 2   8   5   4   0   1   4
                             |
                           6 | 1   5   4   5   1   0   1
                             |
                           7 | 2   4   5   8   4   1   0
                             ---------------------------