Homework 7, POLS 8505: MEASUREMENT
THEORY
Due 5 October 2011
- In this problem we are going to analyze the nations data with
JAGS in R using R2jags
(jags R Description).
JAGS runs fine in
WINDOZE if you use both
JAGS 3.1.0 and
R 2.13.
Download the R
program:
nations_Rtojags_new.r
-- Program to run MCMC on the Log-Normal Bayesian Model for the Nations
data.
- Run nations_Rtojags_new.r and report all the plots
that it produces. How many of the coordinates have more than
one mode in the density plots?
- Run summary(result) and report the tables that it
writes to the screen (NEATLY
FORMATTED!!!).
- Run nations_Rtojags_new.r again and report the
tables (NEATLY FORMATTED!!!) from
summary(result). Are the results the same as before?
- Given that we only have 12 nations and the log-normal model is
highly non-linear, it is not surprising that the the
results may vary somewhat. Let's try adding an additional constraint.
Download the R
program:
nations_Rtojags_new_2.r
-- Program to run MCMC on the Log-Normal Bayesian Model for the Nations
data.
- Run nations_Rtojags_new_2.r and report all the plots
that it produces. How many of the coordinates have more than
one mode in the density plots?
- Run summary(result) and report the tables that it
writes to the screen (NEATLY
FORMATTED!!!).
- Examine the code of nations_Rtojags_new_2.r and
nations_bayes_model_windows_2.txt. What is the
additional constraint that has been added? How does it relate
to the other constraints?
- Run
metric_mds_nations_log_normal_2.r
from Question 1 of Homework 6 and
compare the configuration of nations from the
general
purpose optimization routine -- optim with the configuration
from question (2) above. Let A be the matrix of Nation coordinates
from this question and
B be the matrix of Nation coordinates from question (2). Using the
same method as Question 4 of
Homework 5 solve for the orthogonal procrustes rotation
matrix, T, for B. [To see an example of this examine the following
program using the Morse Code data:
morse_two_ways.r
-- Program to analyze the Morse Code data -- both Upper and Lower
- Solve for T and turn in a neatly formatted listing
of T. Compute the Pearson
r-squares between the corresponding columns of A and B before and
after rotating B.
- Do a two panel graph with the two plots side-by-side -- A
on the left and B on the right.