PyStan announcement: One-based indexing for the names (`flatnames`)

Hi, I just wanted to give a public announcement concerning the recent changes in PyStan (to be released with 2.18).

We are currently going to change the behavior of the parameter names (flatnames) from the zero-based indexing (following Python) to one-based indexing (following Stan). Example prints are shown at the end of this message.

I’m announcing this information here, so if you any of you have any opinions about this, please inform us in the GitHub:

Issue:

PR:

The old print(fit)

# print(fit)

Inference for Stan model: anon_model_68f43e2dc885e62bb7e4c7117e91aa73.
4 chains, each with iter=2000; warmup=1000; thin=1; 
post-warmup draws per chain=1000, total post-warmup draws=4000.

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat
mu         4.54    0.21   3.36   -2.2   2.34    4.5   6.78  10.71    247   1.02
tau        3.88    0.16   2.98   0.79   1.73   3.05   5.18  11.73    340   1.01
theta[0]   6.44    0.21   5.65  -3.43   2.96   5.94   9.61  19.79    729   1.01
theta[1]   5.07    0.19   4.75  -4.57   2.14   5.07   8.21  14.42    646   1.01
theta[2]   4.03    0.22   5.58   -7.5   1.01   4.23   7.43  14.08    620   1.01
theta[3]   4.84     0.2   4.81  -4.93   1.85   4.81   7.93   13.9    593   1.01
theta[4]   3.64     0.2    4.8  -6.61   0.91   3.95    6.8  12.12    596   1.01
theta[5]   4.18     0.2   5.04  -6.23   1.25   4.26    7.5  13.14    659   1.01
theta[6]    6.5     0.2   5.13  -2.67    3.3   6.14   9.25  18.68    640   1.01
theta[7]   4.98    0.16   5.28  -5.12   1.84   4.91   8.24  16.21   1028   1.01
lp__     -15.43    0.48    5.7 -26.53  -19.5 -15.45 -11.09   -4.8    142   1.03

Samples were drawn using NUTS at Thu Feb 15 23:17:51 2018.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at 
convergence, Rhat=1).

And the new one:

# print(fit)

Inference for Stan model: anon_model_68f43e2dc885e62bb7e4c7117e91aa73.
4 chains, each with iter=2000; warmup=1000; thin=1; 
post-warmup draws per chain=1000, total post-warmup draws=4000.

           mean se_mean     sd   2.5%    25%    50%    75%  97.5%  n_eff   Rhat
mu         4.21    0.13   3.27  -2.37   2.01    4.2   6.53  10.55    624   1.01
tau        3.96     0.2   3.27   0.57    1.6   3.06    5.3  12.54    269   1.01
theta[1]   6.27    0.21   5.86  -3.22   2.57   5.76   9.02  20.14    760    1.0
theta[2]   4.88    0.15   4.78  -4.34   1.88   4.83   7.57  14.95   1009   1.01
theta[3]   3.66    0.17   5.44  -8.28   0.75   3.91   7.02  13.71    992   1.01
theta[4]   4.57    0.14   4.81  -4.97   1.63   4.57   7.42  14.44   1133    1.0
theta[5]   3.33    0.16    4.8  -7.03   0.52   3.55   6.53  12.22    899   1.01
theta[6]   3.79    0.15   4.96  -6.99    0.8   4.03   6.95  13.35   1095   1.01
theta[7]   6.42    0.21   5.23  -2.56   2.97   5.98   8.93  19.45    618   1.01
theta[8]   4.72    0.15   5.31  -5.91    1.6   4.69    7.6  16.01   1325    1.0
lp__     -15.18     0.5   6.31 -26.78 -19.54 -15.55  -10.7  -2.89    162   1.02

Samples were drawn using NUTS at Thu Feb 15 23:22:20 2018.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at 
convergence, Rhat=1).
1 Like

Excellent! That matches how they are in Stan.

I can now see why that’s such a bad mismatch with Python. I’d never thought about the 1-based vs. 0-based indexing, since R is 1-based itself.