Problems with IV example from Statistical Rethinking

I noticed that the fit of code 14.26 (the instrumental variable problem) in the Statistical Rethinking numpyro translation (Chapter 14. Adventures in Covariance | Statistical Rethinking (2nd ed.) with NumPyro) has issues with very large r hat values, and the parameter estimates don’t match the textbook closely. Is this a known limitation of numpyro? Or are there other ways to do it within the framework?

               mean       std    median      5.5%     94.5%     n_eff     r_hat
  Rho[0,0]      1.00      0.00      1.00      1.00      1.00       nan       nan
  Rho[0,1]      0.11      0.64      0.45     -1.00      0.53      2.01     14.83
  Rho[1,0]      0.11      0.64      0.45     -1.00      0.53      2.01     14.83
  Rho[1,1]      1.00      0.00      1.00      1.00      1.00       nan      1.00
  Sigma[0]    287.87    497.01      1.01      0.95   1148.57      2.00   8007.16
  Sigma[1]   1229.12   2128.10      0.79      0.76   4914.21      2.00 107101.21
        aE     -0.34      0.59     -0.01     -1.37      0.04      2.01     20.67
        aW     -1.27      2.19     -0.02     -5.06      0.05      2.00     60.57
       bEW     -1.31      2.32     -0.00     -5.33      0.10      2.00     41.73
       bQE      1.40      1.35      0.63      0.59      3.73      2.00     49.61

Number of divergences: 0

Did you run the code and still observe the issue?

@fehiepsi
Yes, I copied and ran code myself and got similar results.

Probably one of the chains is initialized badly. Maybe changing the random seed will help.

1 Like

@fehiepsi
You’re right! I changed the seed from 0 to 1, and now the r hats and estimates are good. Thanks!