POLI 272 BAYESIAN METHODS
Eighth Assignment
Due 8 December 2009 (Extra Credit!)


All homeworks must be neatly typed with Microsoft Word or its equivalent with all R and WINBUGS code shown in an Appendix.

  1. Use the Examples that I have posted of Ernesto Calvo's Interface with WINBUGS to analyze some 2000 U.S. Census data by Congressional District (including D.C.) contained in this STATA file:

    Here are the variables:
    
    . d
    
    Contains data from C:\Inetpub\ftproot\wf1\census2000.dta
      obs:           436                          
     vars:             9                          1 Nov 2001 16:39
     size:        26,160 (97.5% of memory free)
    -------------------------------------------------------------------------------
                  storage  display     value
    variable name   type   format      label      variable label
    -------------------------------------------------------------------------------
    statenmlong     str20  %20s                   name of state
    district        byte   %8.0g                  congressional district number
    total_pop       double %10.0g                 total population of CD
    white00         float  %9.0g                  White%  CD
    black00         float  %9.0g                  Black% CD
    asian00         float  %9.0g                  Asian% CD
    hispanic00      float  %9.0g                  Hispanic% CD
    owner00         float  %9.0g                  % Owner-Occupied housing units CD
    statenm         str7   %9s                    name of state
    -------------------------------------------------------------------------------
    Sorted by:  statenm  district  
    
    . summ
    
        Variable |       Obs        Mean    Std. Dev.       Min        Max
    -------------+--------------------------------------------------------
     statenmlong |         0
        district |       436    9.958716    10.20201          1         52
       total_pop |       436      655617    252357.5     6.7359    5633875
         white00 |       436    74.72752    19.26287       16.8       97.7
         black00 |       436    13.56628    19.08027         .3        188
    -------------+--------------------------------------------------------
         asian00 |       436    3.640826    5.391247         .1       53.5
      hispanic00 |       436    12.23096    16.20432         .6         86
         owner00 |       436    65.83693    11.93698          8       84.3
         statenm |         0
    Run the regression (with the appropriate priors for the betas and tau) of the Percentage of Owner Occupied Housing -- owner00 -- on white00, black00, asian00, and hispanic00. Compare the results to STATA.



  2. Write your own rejection sampler for a substantive problem. For example, here are four R programs illustrating rejection sampling -- two using the Cauchy distribution as the proposal distribution, and two using the Normal distribution as the proposal distribution -- with the posterior distribution a simple beta -- 6X(1-X):
    rejection_sampling_cauchy.r
    rejection_sampling_normal.r
    rejection_sampling_cauchy_scalefactor.r -- this version finds the "c" value by optimizing over the difference in logs
    rejection_sampling_normal_scalefactor.r this version finds the "c" value by optimizing over the difference in logs

  3. "Roll your own" WINBUGS application to a substantive problem of interest to you. Be sure to fully document the problem and the code as well as presenting the appropriate output.