I am running into some issues when using the shape parameter in a model. The issues might be arising from my misunderstanding of how the parameter can be used. Hopefully someone can clear up some things for me.
I have a number of curves, N, that I would like to fit separately. Instead of generating a
for loop to run N separate models, I am using the shape parameter to generate the RVs. The following is an example of what I doing but for a linear fit (for simplicity):
# generate data N = 10 x = np.arange(0, 20) y = x*5+2+np.random.rand(20)*5 x = np.tile(x, (N, 1)) y = np.tile(y, (N, 1)) with pm.Model() as model: a = pm.Normal('a', mu=0, sigma=1, shape=N) b = pm.Normal('b', mu=0, sigma=1, shape=N) like = pm.Normal('like', mu = a*x.T+b, sigma=5, observed=y.T)
My understanding, perhaps incorrectly, is that the N different
b's would be independent of each other, and the samples drawn would also be independent for each set of
However, I am running into the issue that if my N curves contain one set of curve data that is bad, and leads to a badly behaved posterior (e.g. causes divergences), then the all the samples for the other curve seem to be effected (e.g. number of effective samples). At least this is what the arivz summary function seems to be reporting.
I would be grateful if someone could shed some light on this for me.