Built using Zelig version 5.1.4.90000
Wakefield’s Hierarchical Ecological Inference Model with eihier
in ZeligEI.
The EI models accept several different formula syntaxes. If \(C1\) and \(C2\) are the column totals, and \(R1\) and \(R2\) are the row totals, and \(N=R1_i + R2_i = C1_i + C2_i\) is the total in unit \(i\), then the formula can be expressed with just one row and one column, with the totals provided separately as:
z.out <- zelig(C1 ~ R1, N = N, data = data)
The argument N
can be either a numeric vector of the total in each i-th unit, or the character name of a variable in the dataset that contains these values.
Or with both rows and columns coupled together, and omitting the totals:
z.out <- zelig(cbind(C1, C2) ~ cbind(R1, R2), data = data)
Additionally, if C1
, C2
, R1
, R2
are percentages rather than counts, then either formula method above is acceptable, however, N
must always be provided.
First load packages:
library(zeligverse)
Here is an example of all the syntax for the analysis using the first syntax method, and the direct use of the reference classes:
z5 <- zeihier$new()
z5$zelig(C1 ~ R1, N = myN, weights = w, data = myData)
With the Zelig 4 compatibility wrappers this looks like:
z.out <- zelig(C1 ~ R1, N = N, model = "eihier", weights = w,
data = myData)
In addition, Zelig accepts the following additional inputs for eihier
to monitor the convergence of the Markov chain:
burnin
: number of the initial MCMC iterations to be discarded (defaults to 5,000).mcmc
: number of the MCMC iterations after burnin (defaults to 50,000).thin
: thinning interval for the Markov chain. Only every thin
-th draw from the Markov chain is kept. The value of mcmc must be divisible by this value. The default value is 1.verbose
: defaults to FALSE. If TRUE, the progress of the sampler (every 10%) is printed to the screen.seed
: seed for the random number generator. The default is NA which corresponds to a random seed of 12345.The model also accepts the following additional arguments to specify prior parameters used in the model:
m0
: prior mean of \(\mu_0\) (defaults to 0).M0
: prior variance of \(\mu_0\) (defaults to 2.287656).m1
: prior mean of \(\mu_1\) (defaults to 0).M1
: prior variance of \(\mu_1\) (defaults to 2.287656).a0
: \(a0/2\) is the shape parameter for the Inverse Gamma prior on \(\sigma_{02}\). The default is 0.825.b0
: \(b0/2\) is the scale parameter for the Inverse Gamma prior on \(\sigma_{02}\). The default is 0.0105.a1
: \(a1/2\) is the shape parameter for the Inverse Gamma prior on \(\sigma_{12}\). The default is 0.825.b1
: \(b1/2\) is the scale parameter for the Inverse Gamma prior on \(\sigma_{12}\). The default is 0.0105.Users may wish to refer to help(MCMCdynamicEI)
for more options.
We’ll use a dataset from the ei
package, of black and non-black turnout in 141 precincts.
library("ei", quietly=TRUE)
data(sample)
Here is the model estimated in Zelig.
z.out <- zeihier$new()
z.out$zelig(t ~ x, N = "n", data = sample)
summary(z.out)
## Model:
##
## Iterations = 5001:55000
## Thinning interval = 1
## Number of chains = 1
## Sample size per chain = 50000
##
## 1. Empirical mean and standard deviation for each variable,
## plus standard error of the mean:
##
## Mean SD Naive SE Time-series SE
## p0table1 0.026303 0.024893 1.113e-04 4.724e-04
## p0table2 0.141251 0.244145 1.092e-03 1.288e-02
## p0table3 0.081742 0.083925 3.753e-04 2.333e-03
## p0table4 0.297310 0.224443 1.004e-03 1.424e-02
## p0table5 0.368318 0.386424 1.728e-03 2.673e-02
## p0table6 0.116552 0.124114 5.551e-04 3.263e-03
## p0table7 0.240075 0.318980 1.427e-03 1.365e-02
## p0table8 0.245940 0.324350 1.451e-03 1.473e-02
## p0table9 0.072421 0.079865 3.572e-04 2.632e-03
## p0table10 0.056533 0.075480 3.376e-04 2.935e-03
## p0table11 0.010101 0.009928 4.440e-05 1.738e-04
## p0table12 0.028741 0.029864 1.336e-04 6.311e-04
## p0table13 0.136374 0.144092 6.444e-04 5.271e-03
## p0table14 0.170067 0.216839 9.697e-04 1.270e-02
## p0table15 0.002373 0.003043 1.361e-05 4.364e-05
## p0table16 0.167261 0.189368 8.469e-04 9.026e-03
## p0table17 0.833101 0.104059 4.654e-04 2.211e-03
## p0table18 0.293125 0.276818 1.238e-03 1.334e-02
## p0table19 0.626794 0.207239 9.268e-04 5.576e-03
## p0table20 0.689331 0.185100 8.278e-04 4.311e-03
## p0table21 0.488254 0.273866 1.225e-03 1.935e-02
## p0table22 0.011838 0.010748 4.807e-05 2.022e-04
## p0table23 0.115745 0.226519 1.013e-03 2.072e-02
## p0table24 0.005444 0.005602 2.506e-05 9.390e-05
## p0table25 0.741979 0.148523 6.642e-04 5.053e-03
## p0table26 0.266406 0.311339 1.392e-03 2.019e-02
## p0table27 0.112051 0.119673 5.352e-04 3.713e-03
## p0table28 0.333733 0.139033 6.218e-04 5.412e-03
## p0table29 0.392614 0.272541 1.219e-03 1.428e-02
## p0table30 0.040613 0.039030 1.745e-04 8.343e-04
## p0table31 0.141619 0.177561 7.941e-04 9.859e-03
## p0table32 0.157970 0.273157 1.222e-03 1.937e-02
## p0table33 0.538375 0.238481 1.067e-03 8.290e-03
## p0table34 0.002053 0.002569 1.149e-05 3.602e-05
## p0table35 0.109227 0.176433 7.890e-04 9.744e-03
## p0table36 0.376198 0.381139 1.705e-03 2.894e-02
## p0table37 0.012201 0.011618 5.196e-05 2.126e-04
## p0table38 0.732908 0.150506 6.731e-04 5.035e-03
## p0table39 0.808270 0.118185 5.285e-04 2.715e-03
## p0table40 0.450504 0.345379 1.545e-03 2.892e-02
## p0table41 0.146292 0.163640 7.318e-04 6.699e-03
## p0table42 0.189364 0.233201 1.043e-03 1.330e-02
## p0table43 0.088040 0.102554 4.586e-04 3.432e-03
## p0table44 0.156141 0.252453 1.129e-03 1.211e-02
## p0table45 0.262881 0.331507 1.483e-03 1.562e-02
## p0table46 0.348067 0.370796 1.658e-03 2.042e-02
## p0table47 0.428457 0.261871 1.171e-03 1.206e-02
## p0table48 0.125201 0.156287 6.989e-04 7.236e-03
## p0table49 0.153135 0.240455 1.075e-03 1.229e-02
## p0table50 0.270685 0.344916 1.543e-03 2.076e-02
## p0table51 0.063025 0.101082 4.521e-04 4.778e-03
## p0table52 0.205426 0.306250 1.370e-03 2.001e-02
## p0table53 0.296449 0.271827 1.216e-03 1.652e-02
## p0table54 0.185990 0.241534 1.080e-03 1.600e-02
## p0table55 0.045794 0.048555 2.171e-04 1.318e-03
## p0table56 0.200011 0.247434 1.107e-03 1.470e-02
## p0table57 0.053360 0.055950 2.502e-04 1.543e-03
## p0table58 0.547422 0.234420 1.048e-03 1.004e-02
## p0table59 0.448953 0.306062 1.369e-03 2.173e-02
## p0table60 0.017470 0.016408 7.338e-05 3.128e-04
## p0table61 0.757526 0.147451 6.594e-04 3.584e-03
## p0table62 0.091176 0.204666 9.153e-04 1.084e-02
## p0table63 0.691075 0.177357 7.932e-04 5.334e-03
## p0table64 0.093306 0.099198 4.436e-04 2.695e-03
## p0table65 0.201292 0.298520 1.335e-03 1.440e-02
## p0table66 0.200007 0.299749 1.341e-03 1.798e-02
## p0table67 0.200471 0.213044 9.528e-04 9.086e-03
## p0table68 0.663570 0.289564 1.295e-03 2.432e-02
## p0table69 0.894708 0.069733 3.119e-04 1.533e-03
## p0table70 0.215376 0.295695 1.322e-03 6.824e-03
## p0table71 0.759967 0.141859 6.344e-04 3.801e-03
## p0table72 0.919739 0.057113 2.554e-04 1.172e-03
## p0table73 0.031031 0.029803 1.333e-04 6.229e-04
## p0table74 0.082437 0.083435 3.731e-04 2.026e-03
## p0table75 0.099531 0.062230 2.783e-04 1.883e-03
## p1table1 0.085043 0.052051 2.328e-04 9.631e-04
## p1table2 0.947286 0.098959 4.426e-04 5.194e-03
## p1table3 0.201900 0.111024 4.965e-04 3.075e-03
## p1table4 0.718778 0.340654 1.523e-03 2.123e-02
## p1table5 0.445189 0.243325 1.088e-03 1.685e-02
## p1table6 0.128958 0.067995 3.041e-04 1.732e-03
## p1table7 0.708677 0.127803 5.716e-04 5.394e-03
## p1table8 0.729546 0.132980 5.947e-04 5.995e-03
## p1table9 0.359595 0.182401 8.157e-04 5.773e-03
## p1table10 0.647306 0.268441 1.201e-03 1.046e-02
## p1table11 0.021604 0.015020 6.717e-05 2.482e-04
## p1table12 0.392903 0.214731 9.603e-04 4.444e-03
## p1table13 0.279322 0.150684 6.739e-04 5.502e-03
## p1table14 0.567357 0.267027 1.194e-03 1.549e-02
## p1table15 0.010191 0.011167 4.994e-05 1.382e-04
## p1table16 0.465030 0.239553 1.071e-03 1.136e-02
## p1table17 0.940339 0.049970 2.235e-04 1.099e-03
## p1table18 0.899439 0.136163 6.089e-04 6.623e-03
## p1table19 0.937996 0.058457 2.614e-04 1.597e-03
## p1table20 0.964093 0.031416 1.405e-04 7.158e-04
## p1table21 0.584145 0.382427 1.710e-03 2.717e-02
## p1table22 0.097449 0.066109 2.956e-04 1.233e-03
## p1table23 0.846598 0.273642 1.224e-03 2.517e-02
## p1table24 0.019449 0.015364 6.871e-05 2.329e-04
## p1table25 0.846955 0.140586 6.287e-04 4.778e-03
## p1table26 0.482554 0.255790 1.144e-03 1.661e-02
## p1table27 0.227260 0.121029 5.413e-04 3.716e-03
## p1table28 0.661502 0.345494 1.545e-03 1.374e-02
## p1table29 0.865677 0.164600 7.361e-04 8.777e-03
## p1table30 0.175057 0.102233 4.572e-04 2.022e-03
## p1table31 0.568393 0.263539 1.179e-03 1.376e-02
## p1table32 0.843569 0.189679 8.483e-04 1.259e-02
## p1table33 0.907815 0.092102 4.119e-04 3.231e-03
## p1table34 0.028948 0.032561 1.456e-04 3.661e-04
## p1table35 0.736471 0.227761 1.019e-03 1.262e-02
## p1table36 0.423273 0.274002 1.225e-03 2.070e-02
## p1table37 0.037601 0.025090 1.122e-04 4.119e-04
## p1table38 0.860110 0.128814 5.761e-04 4.302e-03
## p1table39 0.947982 0.043733 1.956e-04 9.512e-04
## p1table40 0.631268 0.376518 1.684e-03 3.219e-02
## p1table41 0.369420 0.190007 8.497e-04 7.693e-03
## p1table42 0.533078 0.258071 1.154e-03 1.459e-02
## p1table43 0.370844 0.176800 7.907e-04 5.828e-03
## p1table44 0.957121 0.075855 3.392e-04 4.101e-03
## p1table45 0.649688 0.157347 7.037e-04 7.559e-03
## p1table46 0.434347 0.197551 8.835e-04 1.092e-02
## p1table47 0.866977 0.152493 6.820e-04 7.248e-03
## p1table48 0.540355 0.242945 1.086e-03 1.116e-02
## p1table49 0.947918 0.092896 4.154e-04 4.885e-03
## p1table50 0.626161 0.222393 9.946e-04 1.323e-02
## p1table51 0.755991 0.250840 1.122e-03 1.123e-02
## p1table52 0.750968 0.209243 9.358e-04 1.344e-02
## p1table53 0.856409 0.199669 8.929e-04 1.270e-02
## p1table54 0.612852 0.286608 1.282e-03 1.907e-02
## p1table55 0.396631 0.210662 9.421e-04 5.572e-03
## p1table56 0.507761 0.250182 1.119e-03 1.593e-02
## p1table57 0.366558 0.198587 8.881e-04 5.613e-03
## p1table58 0.855580 0.147907 6.615e-04 6.821e-03
## p1table59 0.684918 0.339231 1.517e-03 2.414e-02
## p1table60 0.060502 0.039282 1.757e-04 7.292e-04
## p1table61 0.936940 0.054129 2.421e-04 1.443e-03
## p1table62 0.954548 0.089378 3.997e-04 4.684e-03
## p1table63 0.912288 0.080804 3.614e-04 2.406e-03
## p1table64 0.213399 0.112816 5.045e-04 3.018e-03
## p1table65 0.848882 0.122624 5.484e-04 5.995e-03
## p1table66 0.760776 0.198522 8.878e-04 1.213e-02
## p1table67 0.310245 0.169668 7.588e-04 7.193e-03
## p1table68 0.479200 0.403982 1.807e-03 3.473e-02
## p1table69 0.972101 0.022567 1.009e-04 4.821e-04
## p1table70 0.863535 0.052944 2.368e-04 1.183e-03
## p1table71 0.917046 0.072898 3.260e-04 1.942e-03
## p1table72 0.985166 0.011742 5.251e-05 2.332e-04
## p1table73 0.096858 0.058695 2.625e-04 1.067e-03
## p1table74 0.119633 0.066341 2.967e-04 1.585e-03
## p1table75 0.718765 0.326145 1.459e-03 9.890e-03
## mu0 -2.126013 0.567258 2.537e-03 2.047e-02
## mu1 0.597450 0.452761 2.025e-03 1.562e-02
## sigma^2.0 12.683669 10.299883 4.606e-02 8.412e-01
## sigma^2.1 10.012387 4.509590 2.017e-02 2.203e-01
##
## 2. Quantiles for each variable:
##
## 2.5% 25% 50% 75% 97.5%
## p0table1 2.504e-05 0.0035646 0.018534 0.046042 0.079484
## p0table2 3.847e-03 0.0163815 0.036876 0.115868 0.969216
## p0table3 3.548e-05 0.0069355 0.046701 0.153536 0.250065
## p0table4 9.376e-02 0.1282980 0.180414 0.438213 0.770126
## p0table5 9.441e-05 0.0164403 0.173275 0.794475 0.997921
## p0table6 4.385e-05 0.0082533 0.060588 0.218980 0.371287
## p0table7 5.837e-05 0.0089811 0.067635 0.380487 0.988577
## p0table8 5.766e-05 0.0089999 0.068407 0.401202 0.990429
## p0table9 3.285e-05 0.0053206 0.034255 0.132647 0.240481
## p0table10 2.053e-05 0.0027292 0.017030 0.085856 0.241414
## p0table11 1.383e-05 0.0016522 0.007214 0.016049 0.034290
## p0table12 2.042e-05 0.0027894 0.016139 0.052404 0.092648
## p0table13 4.086e-05 0.0093393 0.069416 0.262228 0.418060
## p0table14 3.985e-05 0.0063539 0.049411 0.303947 0.635760
## p0table15 5.431e-06 0.0003778 0.001298 0.003196 0.010820
## p0table16 3.617e-05 0.0078038 0.069031 0.320388 0.545483
## p0table17 6.722e-01 0.7435550 0.815829 0.932198 0.999131
## p0table18 6.501e-02 0.1056615 0.159035 0.373583 0.992999
## p0table19 3.565e-01 0.4509867 0.561897 0.810149 0.997948
## p0table20 4.168e-01 0.5308602 0.650336 0.859798 0.998483
## p0table21 1.703e-01 0.2260052 0.398024 0.786581 0.911464
## p0table22 1.431e-05 0.0021068 0.009299 0.019462 0.035815
## p0table23 1.967e-05 0.0020582 0.011851 0.073576 0.800173
## p0table24 9.334e-06 0.0009906 0.003825 0.008158 0.019934
## p0table25 5.470e-01 0.6118486 0.697341 0.878572 0.998365
## p0table26 5.129e-05 0.0102049 0.091036 0.542171 0.860283
## p0table27 4.997e-05 0.0076239 0.056764 0.212774 0.351876
## p0table28 1.752e-01 0.2174151 0.277301 0.450051 0.605614
## p0table29 1.410e-01 0.1922386 0.260084 0.527602 0.995108
## p0table30 3.061e-05 0.0048048 0.027099 0.073620 0.120148
## p0table31 3.546e-05 0.0059682 0.045215 0.247393 0.530289
## p0table32 3.393e-05 0.0041806 0.026821 0.151190 0.981178
## p0table33 2.615e-01 0.3399242 0.447350 0.730268 0.997536
## p0table34 5.678e-06 0.0003554 0.001167 0.002773 0.009154
## p0table35 2.813e-05 0.0039486 0.024943 0.122405 0.654754
## p0table36 7.729e-05 0.0177104 0.198830 0.814360 0.969842
## p0table37 1.615e-05 0.0019718 0.008980 0.019937 0.039273
## p0table38 5.354e-01 0.6029707 0.687659 0.869103 0.998287
## p0table39 6.255e-01 0.7067013 0.788034 0.919434 0.998968
## p0table40 9.480e-02 0.1397938 0.285645 0.835336 0.998973
## p0table41 4.028e-05 0.0081522 0.065135 0.277556 0.477584
## p0table42 4.920e-05 0.0075835 0.062397 0.341291 0.677673
## p0table43 3.126e-05 0.0052255 0.037148 0.155342 0.312277
## p0table44 4.618e-03 0.0193796 0.044487 0.141312 0.977331
## p0table45 6.246e-05 0.0103909 0.080638 0.455637 0.992354
## p0table46 1.141e-04 0.0183251 0.161940 0.714445 0.997253
## p0table47 1.701e-01 0.2266078 0.307224 0.583247 0.996165
## p0table48 3.594e-05 0.0058296 0.042808 0.208808 0.477193
## p0table49 8.563e-03 0.0250597 0.050128 0.141529 0.966845
## p0table50 7.037e-05 0.0097637 0.076899 0.475683 0.995272
## p0table51 2.359e-05 0.0024821 0.014260 0.068174 0.358498
## p0table52 4.792e-05 0.0062111 0.043586 0.263358 0.988170
## p0table53 7.992e-02 0.1165457 0.163941 0.364715 0.991741
## p0table54 3.629e-05 0.0058704 0.046358 0.334846 0.705581
## p0table55 2.321e-05 0.0038632 0.024093 0.085419 0.147522
## p0table56 4.071e-05 0.0076252 0.061738 0.367482 0.710442
## p0table57 2.931e-05 0.0046273 0.028652 0.099010 0.168533
## p0table58 2.842e-01 0.3517299 0.449810 0.737159 0.997249
## p0table59 1.425e-01 0.1918540 0.294993 0.734703 0.998013
## p0table60 2.014e-05 0.0026436 0.012763 0.029413 0.053891
## p0table61 5.415e-01 0.6294454 0.726428 0.897882 0.998701
## p0table62 2.947e-05 0.0023376 0.012513 0.057476 0.906406
## p0table63 4.561e-01 0.5376323 0.638436 0.854424 0.998280
## p0table64 4.370e-05 0.0068517 0.048702 0.174354 0.296376
## p0table65 5.824e-05 0.0065782 0.044682 0.260969 0.988997
## p0table66 4.144e-05 0.0060992 0.043817 0.253007 0.986221
## p0table67 5.276e-05 0.0114635 0.100030 0.394076 0.604252
## p0table68 2.683e-01 0.3479090 0.698697 0.972415 0.999639
## p0table69 7.688e-01 0.8387589 0.891061 0.959009 0.999396
## p0table70 5.329e-05 0.0085447 0.061461 0.313409 0.979269
## p0table71 5.610e-01 0.6363926 0.725162 0.892005 0.998714
## p0table72 8.049e-01 0.8772798 0.921998 0.971603 0.999499
## p0table73 2.585e-05 0.0036858 0.021140 0.055268 0.093547
## p0table74 4.144e-05 0.0071915 0.048515 0.154275 0.250896
## p0table75 3.602e-02 0.0521064 0.071452 0.137968 0.240051
## p1table1 9.022e-04 0.0384640 0.091894 0.125286 0.176541
## p1table2 6.181e-01 0.9584060 0.990285 0.997595 0.999920
## p1table3 1.701e-03 0.1041688 0.240014 0.292274 0.351211
## p1table4 6.520e-03 0.5033275 0.901725 0.982174 0.999624
## p1table5 4.538e-02 0.1786020 0.565113 0.657025 0.709428
## p1table6 1.840e-03 0.0715656 0.151650 0.182774 0.222330
## p1table7 4.086e-01 0.6509220 0.768658 0.798645 0.831608
## p1table8 4.222e-01 0.6654035 0.793539 0.823955 0.854991
## p1table9 3.403e-03 0.2176040 0.434719 0.504585 0.574810
## p1table10 7.880e-03 0.5405466 0.775875 0.835418 0.889105
## p1table11 3.764e-04 0.0094818 0.020410 0.030901 0.055288
## p1table12 3.168e-03 0.2061105 0.463989 0.568092 0.678677
## p1table13 2.676e-03 0.1449081 0.340444 0.403210 0.461967
## p1table14 4.708e-03 0.3991016 0.708338 0.763843 0.810803
## p1table15 1.380e-04 0.0025890 0.006603 0.013810 0.040841
## p1table16 3.696e-03 0.2683716 0.581142 0.657948 0.717868
## p1table17 8.457e-01 0.8962882 0.951518 0.987710 0.999725
## p1table18 5.525e-01 0.8604896 0.967928 0.993156 0.999830
## p1table19 8.215e-01 0.8884562 0.958582 0.990582 0.999798
## p1table20 9.010e-01 0.9375824 0.972917 0.992899 0.999832
## p1table21 2.681e-03 0.1646001 0.712013 0.960194 0.999369
## p1table22 8.626e-04 0.0377519 0.097973 0.146804 0.226922
## p1table23 1.609e-02 0.8968510 0.969392 0.984417 0.994190
## p1table24 2.988e-04 0.0075235 0.016723 0.027822 0.057056
## p1table25 5.862e-01 0.7200163 0.892613 0.978182 0.999621
## p1table26 2.893e-03 0.2549931 0.619623 0.686100 0.736979
## p1table27 2.202e-03 0.1241002 0.273879 0.324917 0.380076
## p1table28 6.555e-03 0.3684157 0.812372 0.966135 0.999442
## p1table29 4.945e-01 0.7849592 0.949513 0.989553 0.999789
## p1table30 1.660e-03 0.0816432 0.199294 0.258875 0.331265
## p1table31 5.041e-03 0.4100644 0.702873 0.764468 0.813856
## p1table32 2.777e-01 0.8474786 0.929663 0.949748 0.967873
## p1table33 7.199e-01 0.8355066 0.945375 0.987711 0.999735
## p1table34 2.628e-04 0.0066133 0.018052 0.039567 0.119262
## p1table35 2.834e-02 0.7175506 0.837196 0.870724 0.904655
## p1table36 1.336e-03 0.1089385 0.548989 0.671018 0.725825
## p1table37 5.173e-04 0.0161820 0.037164 0.054749 0.090057
## p1table38 6.169e-01 0.7463795 0.902590 0.979227 0.999636
## p1table39 8.643e-01 0.9097129 0.957805 0.989297 0.999770
## p1table40 2.849e-02 0.2105289 0.812514 0.975943 0.999595
## p1table41 3.167e-03 0.2145238 0.455747 0.521544 0.580143
## p1table42 4.211e-03 0.3633240 0.665802 0.728121 0.777839
## p1table43 4.806e-03 0.2509771 0.446242 0.506586 0.570669
## p1table44 7.147e-01 0.9621063 0.991411 0.997880 0.999927
## p1table45 3.019e-01 0.5576364 0.727410 0.765291 0.802724
## p1table46 8.522e-02 0.2410255 0.528271 0.601461 0.652353
## p1table47 5.292e-01 0.7768703 0.940087 0.988017 0.999762
## p1table48 6.447e-03 0.4085583 0.658656 0.719888 0.774531
## p1table49 6.398e-01 0.9527866 0.988909 0.997223 0.999912
## p1table50 1.563e-01 0.4939186 0.742976 0.789715 0.830039
## p1table51 2.028e-02 0.7410392 0.869001 0.905401 0.939722
## p1table52 2.191e-01 0.7106419 0.853261 0.885321 0.915034
## p1table53 3.441e-01 0.8079839 0.956866 0.990968 0.999772
## p1table54 5.527e-03 0.4340959 0.770876 0.822060 0.863105
## p1table55 3.825e-03 0.2180172 0.476487 0.568393 0.658863
## p1table56 3.312e-03 0.3363768 0.639252 0.695949 0.745564
## p1table57 2.372e-03 0.1960228 0.441420 0.529277 0.614229
## p1table58 5.591e-01 0.7374205 0.919909 0.984352 0.999678
## p1table59 6.952e-02 0.3683379 0.859072 0.977548 0.999623
## p1table60 7.023e-04 0.0255467 0.062409 0.089405 0.136404
## p1table61 8.342e-01 0.8886420 0.950897 0.987823 0.999736
## p1table62 6.048e-01 0.9682900 0.987589 0.993818 0.998163
## p1table63 7.572e-01 0.8402269 0.939424 0.986634 0.999726
## p1table64 2.513e-03 0.1183420 0.253994 0.304037 0.362126
## p1table65 5.275e-01 0.8231573 0.907288 0.927834 0.947693
## p1table66 2.429e-01 0.7241800 0.857255 0.887127 0.914797
## p1table67 2.557e-03 0.1551307 0.383853 0.452072 0.506901
## p1table68 6.461e-03 0.0478914 0.430187 0.930099 0.999245
## p1table69 9.260e-01 0.9542222 0.976107 0.993073 0.999804
## p1table70 7.287e-01 0.8442435 0.883099 0.900233 0.921304
## p1table71 7.792e-01 0.8516297 0.937702 0.985473 0.999707
## p1table72 9.600e-01 0.9766782 0.986892 0.995801 0.999865
## p1table73 1.001e-03 0.0437508 0.106662 0.143305 0.195881
## p1table74 1.320e-03 0.0607472 0.139461 0.173290 0.215091
## p1table75 9.981e-03 0.5149482 0.882433 0.977961 0.999591
## mu0 -3.313e+00 -2.4790924 -2.101369 -1.744849 -1.085484
## mu1 -2.825e-01 0.2992824 0.595197 0.892894 1.495586
## sigma^2.0 4.344e+00 7.2267889 10.002835 14.686608 36.034381
## sigma^2.1 4.293e+00 6.9004834 9.024008 12.000977 21.360369
You can check for convergence before summarizing the estimates with three diagnostic tests. See the section Diagnostics for Zelig Models for examples of the output with interpretation:
z.out$geweke.diag()
z.out$heidel.diag()
z.out$raftery.diag()
The Wakefield hierarchical model is part of the MCMCpack package by Andrew Martin, Kevin Quinn, and Jong Hee Park. Advanced users may wish to refer to help(MCMChierEI)
in the MCMCpack package.
Wakefield J (2004). “Ecological Inference for 2 x 2 Tables.” Journal of the Royal Statistical Society, Series A., 167 (3), pp. 385-445.
Martin AD, Quinn KM and Park JH (2011). “MCMCpack: Markov Chain Monte Carlo in R.” Journal of Statistical Software, 42 (9), pp. 22. <URL: http://www.jstatsoft.org/v42/i09/>.