Homework 7, POLS 8505: MEASUREMENT THEORY
Due 2 March 2015



  1. The aim of this problem is to show you how to use Orthogonal Procrustes Rotation. Let A be the matrix of Morse Code two dimensional coordinates from the Lower Half of the Similarities matrix that you analyzed in Question 1 of Homework 3 (recall you plotted these!) after subtracting off the column means, and let B be the matrix of legislator coordinates from the Upper Half of the Similarities Matrix after subtracting off the column means. Note that subtracting off the column means of both matrices centers both at the origin, (0.0, 0.0). Solve for the orthogonal procrustes rotation matrix, T, for B. Namely, we want to minimize:

    L(T) = tr(A - BT)(A - BT)'

    The solution is:

    T = VU' where

    A'B = ULV'

    where ULV' is the Singular Value Decomposition of A'B (see Borg and Groenen, pp. 430-432).

    In R you can perform the decompostion with the svd command. For example:

    C <- t(A)%*%B
    svddecomp <- svd(C)


    svddecomp$u has the matrix U
    svddecomp$v has the matrix V
    svddecomp$d has the diagonal of L

    Note that you can check your work as we discussed in class by doing the following:

    D <- diag(svddecomp$d)
    U <- svddecomp$u
    V <- svddecomp$v
    ABCHECK <- U%*%D%*%t(V)
    errorcheck <- sum((C-ABCHECK)^2)


    1. Solve for T and turn in a neatly formatted listing. Compute the Pearson r-squares between the corresponding columns of A and B before and after rotating B.

    2. Do a two panel graph with the two plots side-by-side -- A on the left and the rotated version of B on the right. Below is a code fragment showing how to do this:
      #
      par(mfrow=c(1,2))
      #
      # mar
      # A numerical vector of the form c(bottom, left, top, right) which 
      # gives the number of lines of margin to be specified on the four 
      # sides of the plot. The default is c(5, 4, 4, 2) + 0.1.
      #  Note that you might want to make the right-hand side margin narrower so that the plots are closer together 
      #  You may want to experiment with the parameters until the plot looks nice!
      #  This puts more white space
      #    on the Right-Hand-Side Margin
      #
      par(mar=c(4.1,5.1,4.1,5.1))
      #
      #
      plot(dimension1,dimension2,type="n",asp=1,
             main="",
             xlab="",
             ylab="",
             xlim=c(-2.0,2.0),ylim=c(-2.0,2.0))
      points(dimension1,dimension2,pch=16,col="red")
      axis(1,font=2)
      axis(2,font=2,cex=1.2)
      # Main title
      mtext("Morse Code Signals Lower Half Matrix",side=3,line=1.00,cex=1.2,font=2)
      # x-axis title
      mtext("Best Interpretation!!",side=1,line=2.75,cex=1.2)
      # y-axis title
      mtext("Best Interpretation!!",side=2,line=2.5,cex=1.2)
      #
      # pos -- a position specifier for the text. Values of 1, 2, 3 and 4, 
      # respectively indicate positions below, to the left of, above and 
      # to the right of the specified coordinates 
      #
      namepos <- rep(4,nrow)
      #
      #
      text(dimension1,dimension2,names,pos=namepos,offset=00.00,col="blue")
      #
      #  Right hand Plot
      #
      plot(dimension11,dimension22,type="n",asp=1,
             main="",
             xlab="",
             ylab="",
             xlim=c(-2.0,2.0),ylim=c(-2.0,2.0))
      points(dimension11,dimension22,pch=16,col="red")
      axis(1,font=2)
      axis(2,font=2,cex=1.2)
      # Main title
      mtext("Morse Code Signals Upper Half Matrix",side=3,line=1.00,cex=1.2,font=2)
      # x-axis title
      mtext("Best Interpretation!!",side=1,line=2.75,cex=1.2)
      # y-axis title
      mtext("Best Interpretation!!",side=2,line=2.5,cex=1.2)
      #
      # pos -- a position specifier for the text. Values of 1, 2, 3 and 4, 
      # respectively indicate positions below, to the left of, above and 
      # to the right of the specified coordinates 
      #
      namepos <- rep(4,nrow)
      #
      #
      text(dimension11,dimension22,names,pos=namepos,offset=00.00,col="blue")
    3. Use the Orthogonal Procrustes Rotation function from MCMCpack to do the rotation. You can see how to do it by inspecting this R program: smacof_nonmetric_nations_Procrustes_rotation.r Turn in the resulting two panel plot and a listing of your R program.

  2. Work Problem (1) on page 143 of Analyzing Spatial Models of Choice and Judgment With R.

  3. Work Problem (2) on pages 143-144 of Analyzing Spatial Models of Choice and Judgment With R.