# The example doesn't converge well and posteriors fluctuated

Hi,
I’ve made a practice based on the following problem:
[https://www.stata.com/meeting/chicago16/slides/chicago16_balov.pdf]

When I tried to sampling, the model seems to not converge. I even saw fluctuation of the results pretty much, which leads to different posterior predictive probability of death rate each run!
All my numbers, models are based on this example, and this example even exists in a textbook. And the probabilities predicted by my PyMC3 version is no where closed to what presented on the textbooks and in the slide

What have I done wrong?

Best Regards

death_rate.py (1.7 KB)

Since it doesn’t allow me to put two links, I post my data here:
cardiac_surgery.csv (126 Bytes)

Nice pdf, unfortunately, I don’t understand the syntaxis. You have `sigma` and `mu` from Stata, and you have `sigma` and `mu` from `pymc3` (with the model you write):

``````     mean        sd  mc_error   hpd_2.5  hpd_97.5        n_eff      Rhat
mu    -2.554693  0.152617  0.001789 -2.862648 -2.260096  5698.136869  0.999824
sigma  0.407766  0.152828  0.002793  0.162044  0.710085  2730.712827  1.001235
``````

You could do other posterior checks. By the way, Stan gives these results:

``````           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat
mu        -2.55  2.1e-3   0.15  -2.86  -2.64  -2.55  -2.46  -2.27   4948    1.0
sigma       0.4  3.3e-3   0.16   0.16   0.29   0.38   0.48   0.78   2298    1.0
``````

Hi,
Interesting. Stan give the results fairly closed to what I achieve.

What I don’t get is the pymc3 complains that the model might not converge what so ever. And the results will fluctuate around. Is it expected from pymc3 modeling, that the results might not fixed, but will vary in an acceptable range?

Cheers