Hi everyone,
I just started working with PyStan, as I plan to slowly move my workload over from R to Python as much as possible. One of the big barriers to this was Python's relatively nascient statistical abilities, but PyStan removes that barrier almost entirely, so thanks!
I have two questions:
1) Is it possible in Python to see a traceplot of just one parameter? If I have a fitted object, I can see a traceplot of all parameters using fit.traceplot(). However, this is incredibly cumbersome if you have lots of parameters (including things like predicted values). In R, I can use a command traceplot(posteriors, pars = 'beta') to see a traceplot of JUST beta, but this capability is missing so far as I know. Is this something that can be added to PyStan or am I just doing it wrong? I can do it myself using the following lines:
# traceplot plots for each parameter
beta = fit.extract(permuted=True)['beta']
# stan_args gives one list per chain
n_chains = len(fit.stan_args)
# assumes that the beta array is just one chain tacked onto the end of another
bSplit = np.array_split(beta, n_chains)
# plot
for i in range(n_chains):
py.plot(bSplit[i])
py.show()
but I'd prefer a parameter argument like in R.
2) This issue is a little more quirky than anything. I can run PyStan fine most times. My code runs fine from the Terminal and as well as the interactive interpreter in Spyder (an IDE). But when I try to run it in an interactive interpreter in PyCharm (a better IDE), the model appears to compile in to C++ just fine but then spits about an error message for what appears to be at every iteration of the model (10,000 or so)
Process PoolWorker-5827:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/process.py", line 249, in _bootstrap
sys.stdin.close()
AttributeError: StdIn instance has no attribute 'close'
I don't know what this means, and it appears to be fairly specific to PyCharm. But I just wanted to report it so that you all are aware that PyStan may not work in some interactive interpreters.
Thanks!
Nate