I have whittled a bug in my results down to this disturbing discrepancy between fit.summary()
and fit.draws_pd().describe()
.
It seems the former is (a) rounding by significant figures , but also (b) making mistakes.
In particular, the problem that led me here is the value for StdDev of posterior_fraclow in fit.summary(). Please compare this with the true std given by pandas. Is there something I don’t understand about what fit.summary() should do?
ipdb> fit.summary(percentiles=self.percentiles)
Mean MCSE StdDev 2.5% 25% 50% 75% 97.5% N_Eff N_Eff/s R_hat
name
lp__ -9700.0000 0.120000 3.1000 -9700.0000 -9700.0000 -9700.0000 -9700.0000 -9700.0000 640.0 0.0270 1.0
betaN[1] 2.1000 0.015000 0.3500 1.4000 1.9000 2.1000 2.4000 2.8000 580.0 0.0240 1.0
betaN[2] 0.0610 0.002000 0.0700 -0.0760 0.0140 0.0590 0.1100 0.2000 1209.0 0.0500 1.0
betaN[3] 0.3300 0.005900 0.1400 0.0910 0.2300 0.3200 0.4200 0.6300 579.0 0.0240 1.0
betaS[1] 0.1700 0.000450 0.0270 0.1200 0.1500 0.1700 0.1900 0.2200 3571.0 0.1500 1.0
betaS[2] 0.2600 0.000780 0.0320 0.2000 0.2400 0.2600 0.2800 0.3200 1638.0 0.0680 1.0
cH[1] -7.4000 0.120000 1.9000 -12.0000 -8.3000 -6.9000 -6.0000 -5.1000 254.0 0.0110 1.0
cH[2] -4.7000 0.010000 0.2300 -5.1000 -4.9000 -4.7000 -4.5000 -4.2000 486.0 0.0200 1.0
cH[3] -3.8000 0.005300 0.1300 -4.0000 -3.9000 -3.8000 -3.7000 -3.5000 607.0 0.0250 1.0
cH[4] -3.0000 0.003300 0.0880 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 713.0 0.0300 1.0
cH[5] -2.3000 0.002100 0.0700 -2.4000 -2.4000 -2.3000 -2.3000 -2.2000 1088.0 0.0450 1.0
cH[6] -1.6000 0.007300 0.1600 -2.1000 -1.7000 -1.6000 -1.5000 -1.4000 486.0 0.0200 1.0
cH[7] -1.0000 0.004100 0.0970 -1.3000 -1.1000 -0.9900 -0.9400 -0.8500 548.0 0.0230 1.0
cH[8] 0.0078 0.002400 0.0620 -0.1200 -0.0350 0.0070 0.0480 0.1300 656.0 0.0270 1.0
cH[9] 1.6000 0.004100 0.1100 1.4000 1.5000 1.5000 1.6000 1.8000 697.0 0.0290 1.0
cH[10] 4.0000 0.062000 1.5000 2.7000 3.1000 3.5000 4.2000 8.1000 604.0 0.0250 1.0
cL[1] -3.5000 0.073000 1.0000 -6.5000 -3.7000 -3.3000 -3.0000 -2.6000 200.0 0.0083 1.0
cL[2] -0.9400 0.033000 0.7100 -2.8000 -1.2000 -0.7900 -0.4600 -0.0025 453.0 0.0190 1.0
posterior_hist_high[1] 0.0015 0.000080 0.0017 0.0000 0.0002 0.0008 0.0024 0.0060 469.0 0.0200 1.0
posterior_hist_high[2] 0.0071 0.000026 0.0017 0.0040 0.0060 0.0070 0.0082 0.0110 4288.0 0.1800 1.0
posterior_hist_high[3] 0.0120 0.000037 0.0022 0.0078 0.0100 0.0120 0.0130 0.0160 3424.0 0.1400 1.0
posterior_hist_high[4] 0.0230 0.000046 0.0030 0.0180 0.0210 0.0230 0.0250 0.0290 4196.0 0.1700 1.0
posterior_hist_high[5] 0.0390 0.000075 0.0039 0.0310 0.0360 0.0390 0.0420 0.0460 2667.0 0.1100 1.0
posterior_hist_high[6] 0.0670 0.001000 0.0230 0.0060 0.0550 0.0700 0.0840 0.1000 513.0 0.0210 1.0
posterior_hist_high[7] 0.0900 0.000090 0.0057 0.0790 0.0860 0.0900 0.0940 0.1000 4015.0 0.1700 1.0
posterior_hist_high[8] 0.2000 0.000120 0.0079 0.1900 0.2000 0.2000 0.2100 0.2200 4401.0 0.1800 1.0
posterior_hist_high[9] 0.2800 0.000160 0.0089 0.2600 0.2800 0.2800 0.2900 0.3000 3164.0 0.1300 1.0
posterior_hist_high[10] 0.1300 0.000110 0.0066 0.1200 0.1300 0.1300 0.1400 0.1500 3563.0 0.1500 1.0
posterior_hist_high[11] 0.0280 0.000700 0.0180 0.0000 0.0130 0.0270 0.0410 0.0590 631.0 0.0260 1.0
posterior_hist_low[1] 0.0045 0.000073 0.0020 0.0002 0.0032 0.0046 0.0058 0.0082 768.0 0.0320 1.0
posterior_hist_low[2] 0.0350 0.001000 0.0220 0.0010 0.0190 0.0320 0.0480 0.0900 497.0 0.0210 1.0
posterior_hist_low[3] 0.0760 0.000740 0.0180 0.0420 0.0620 0.0760 0.0910 0.1100 600.0 0.0250 1.0
posterior_fraclow 0.1000 0.000000 0.0000 0.1000 0.1000 0.1000 0.1000 0.2000 535.9 0.0000 1.0
posterior_mean_high 7.1000 0.000000 0.1000 6.9000 7.0000 7.1000 7.2000 7.2000 773.1 0.0000 1.0
posterior_mean_low 8.2000 0.000000 0.6000 7.1000 7.7000 8.1000 8.6000 9.4000 509.7 0.0000 1.0
posterior_hist_latent[1] 0.0017 0.000090 0.0020 0.0000 0.0002 0.0010 0.0026 0.0068 466.0 0.0190 1.0
posterior_hist_latent[2] 0.0082 0.000032 0.0019 0.0046 0.0068 0.0080 0.0094 0.0120 3649.0 0.1500 1.0
posterior_hist_latent[3] 0.0140 0.000046 0.0025 0.0088 0.0120 0.0140 0.0150 0.0190 2974.0 0.1200 1.0
posterior_hist_latent[4] 0.0270 0.000063 0.0035 0.0200 0.0240 0.0260 0.0290 0.0330 3101.0 0.1300 1.0
posterior_hist_latent[5] 0.0450 0.000100 0.0045 0.0360 0.0420 0.0450 0.0480 0.0530 1961.0 0.0820 1.0
posterior_hist_latent[6] 0.0760 0.001100 0.0240 0.0072 0.0640 0.0800 0.0930 0.1100 505.0 0.0210 1.0
posterior_hist_latent[7] 0.1000 0.000210 0.0074 0.0880 0.0980 0.1000 0.1100 0.1200 1252.0 0.0520 1.0
posterior_hist_latent[8] 0.2300 0.000410 0.0120 0.2100 0.2200 0.2300 0.2400 0.2500 885.0 0.0370 1.0
posterior_hist_latent[9] 0.3200 0.000580 0.0150 0.2900 0.3100 0.3200 0.3300 0.3500 671.0 0.0280 1.0
posterior_hist_latent[10] 0.1500 0.000270 0.0092 0.1300 0.1400 0.1500 0.1600 0.1700 1184.0 0.0490 1.0
posterior_hist_latent[11] 0.0300 0.000750 0.0190 0.0000 0.0150 0.0310 0.0450 0.0630 633.0 0.0260 1.0
posterior_mean_latent 7.1000 0.000000 0.1000 6.9000 7.0000 7.1000 7.1000 7.2000 781.2 0.0000 1.0
ipdb> fit.draws_pd().describe().T
count mean std min 25% 50% 75% max
lp__ 4000.0 -9737.438482 3.110194 -9.753210e+03 -9739.410000 -9737.140000 -9735.110000 -9730.570000
accept_stat__ 4000.0 0.886251 0.201089 1.733110e-07 0.883991 0.962808 0.992227 1.000000
stepsize__ 4000.0 0.012548 0.001323 1.083700e-02 0.011523 0.012584 0.013609 0.014186
treedepth__ 4000.0 7.862250 0.778091 2.000000e+00 8.000000 8.000000 8.000000 10.000000
n_leapfrog__ 4000.0 328.577500 168.906977 6.000000e+00 255.000000 255.000000 511.000000 1023.000000
divergent__ 4000.0 0.019500 0.138291 0.000000e+00 0.000000 0.000000 0.000000 1.000000
energy__ 4000.0 9745.921030 4.286429 9.734660e+03 9742.890000 9745.610000 9748.580000 9763.430000
betaN[1] 4000.0 2.132952 0.354704 1.256090e+00 1.876807 2.126305 2.373512 3.536540
betaN[2] 4000.0 0.061456 0.070473 -2.137460e-01 0.013832 0.058983 0.107139 0.363367
betaN[3] 4000.0 0.334623 0.141327 8.126970e-03 0.233353 0.318071 0.423662 0.908631
betaS[1] 4000.0 0.172014 0.026604 6.404760e-02 0.154348 0.172261 0.189735 0.265383
betaS[2] 4000.0 0.263793 0.031640 1.499710e-01 0.242053 0.263876 0.284507 0.365405
cH[1] 4000.0 -7.389239 1.858605 -1.330360e+01 -8.344217 -6.892330 -5.986508 -4.759050
cH[2] 4000.0 -4.688734 0.231254 -5.425980e+00 -4.851625 -4.695135 -4.533048 -3.912510
cH[3] 4000.0 -3.786661 0.129760 -4.255640e+00 -3.878600 -3.790660 -3.698860 -3.337060
cH[4] 4000.0 -2.999632 0.088324 -3.287630e+00 -3.060935 -3.002090 -2.939213 -2.684350
cH[5] 4000.0 -2.307452 0.069657 -2.569810e+00 -2.355427 -2.311110 -2.262328 -2.063150
cH[6] 4000.0 -1.626288 0.160516 -2.294240e+00 -1.699467 -1.596975 -1.519730 -1.282450
cH[7] 4000.0 -1.004561 0.097060 -1.371650e+00 -1.058200 -0.994765 -0.937240 -0.717693
cH[8] 4000.0 0.007829 0.061590 -2.003920e-01 -0.034750 0.006998 0.047626 0.233727
cH[9] 4000.0 1.550612 0.108371 1.269790e+00 1.468953 1.542665 1.628295 1.856150
cH[10] 4000.0 4.007934 1.520068 2.474910e+00 3.115775 3.504180 4.243977 15.156800
cL[1] 4000.0 -3.532115 1.038526 -1.296720e+01 -3.686590 -3.324145 -3.031042 -1.998350
cL[2] 4000.0 -0.937627 0.711832 -7.596520e+00 -1.238128 -0.790392 -0.459250 0.385840
posterior_hist_high[1] 4000.0 0.001525 0.001722 0.000000e+00 0.000200 0.000800 0.002400 0.008602
posterior_hist_high[2] 4000.0 0.007134 0.001707 2.200440e-03 0.006001 0.007001 0.008202 0.013403
posterior_hist_high[3] 4000.0 0.011988 0.002193 6.001200e-03 0.010402 0.011802 0.013403 0.022604
posterior_hist_high[4] 4000.0 0.023194 0.002966 1.460290e-02 0.021204 0.023205 0.025005 0.034607
posterior_hist_high[5] 4000.0 0.039038 0.003879 2.560510e-02 0.036407 0.039008 0.041608 0.053611
posterior_hist_high[6] 4000.0 0.067493 0.022675 0.000000e+00 0.055211 0.070414 0.083617 0.119224
posterior_hist_high[7] 4000.0 0.090157 0.005699 7.121420e-02 0.086217 0.090018 0.093819 0.110022
posterior_hist_high[8] 4000.0 0.200940 0.007854 1.740350e-01 0.195589 0.201040 0.206241 0.229046
posterior_hist_high[9] 4000.0 0.281001 0.008902 2.492500e-01 0.275055 0.280856 0.287057 0.312062
posterior_hist_high[10] 4000.0 0.134251 0.006627 1.118220e-01 0.129626 0.134227 0.138628 0.165033
posterior_hist_high[11] 4000.0 0.027630 0.017556 0.000000e+00 0.013003 0.027405 0.041008 0.076415
posterior_hist_low[1] 4000.0 0.004462 0.002024 0.000000e+00 0.003201 0.004601 0.005801 0.011802
posterior_hist_low[2] 4000.0 0.035232 0.022478 0.000000e+00 0.018604 0.032206 0.047609 0.110422
posterior_hist_low[3] 4000.0 0.075953 0.018173 2.520500e-02 0.062012 0.075615 0.090668 0.121024
posterior_fraclow 4000.0 0.115647 0.032954 3.660730e-02 0.091418 0.111622 0.136277 0.217443
posterior_mean_high 4000.0 7.095085 0.076369 6.839950e+00 7.042810 7.099115 7.150103 7.329180
posterior_mean_low 4000.0 8.163858 0.616248 6.639780e+00 7.703155 8.085820 8.561182 10.000000
posterior_hist_latent[1] 4000.0 0.001740 0.001952 0.000000e+00 0.000200 0.001000 0.002601 0.010802
posterior_hist_latent[2] 4000.0 0.008179 0.001928 2.600520e-03 0.006801 0.008002 0.009402 0.017003
posterior_hist_latent[3] 4000.0 0.013725 0.002497 6.801360e-03 0.012002 0.013603 0.015403 0.025205
posterior_hist_latent[4] 4000.0 0.026564 0.003484 1.620320e-02 0.024205 0.026405 0.028806 0.040408
posterior_hist_latent[5] 4000.0 0.044680 0.004514 3.040610e-02 0.041608 0.044609 0.047609 0.063013
posterior_hist_latent[6] 4000.0 0.076277 0.024167 0.000000e+00 0.063813 0.079616 0.093419 0.129826
posterior_hist_latent[7] 4000.0 0.102754 0.007400 7.901580e-02 0.097619 0.102420 0.107421 0.130226
posterior_hist_latent[8] 4000.0 0.228097 0.012109 1.884380e-01 0.219644 0.227245 0.235647 0.278456
posterior_hist_latent[9] 4000.0 0.316985 0.015136 2.734550e-01 0.306261 0.316063 0.326465 0.374075
posterior_hist_latent[10] 4000.0 0.150628 0.009166 1.196240e-01 0.144229 0.150230 0.156431 0.181836
posterior_hist_latent[11] 4000.0 0.030371 0.018747 0.000000e+00 0.015003 0.030606 0.045009 0.081216
posterior_mean_latent 4000.0 7.083868 0.073540 6.839770e+00 7.034760 7.088220 7.136230 7.311260