# Sampler issues on Beta prior Binomial likelihood

Can anyone help me understand what’s going on with sampling here?

I used a pretty vanilla test case to try out new PyMC. But, it’s converged on wrong values. They’re off by a scale of 100-1000…

You need to either treat the observations as a set:

``````lik_ctrl = pm.Binomial('likelihood',p=theta_ctrl, n=len(ris_test), observed=np.sum(ris_ctrl))
``````

Or, equivalently, use treat each one individually:

``````lik_ctrl = pm.Bernoulli('likelihood',p=theta_ctrl, observed=ris_ctrl)
``````

Right now, you are trying to get a set of `len(ris_test)` flips to reproduce an observed 0, then a set of `len(ris_test)` flips to reproduce an observed 1, etc.

W/ option `1:TypeError: Binomial.dist() missing 1 required positional argument: 'n'`
And option 2: It did work!

Still, why is supplying a vector to PyMC not working? Strange that n is required…I suppose it doesn’t know that it has received a vector for some reason.

First one works for me. `n` is defined as `n=len(ris_test)`. Are you sure you pasted that in correctly?

I think it is working, it’s just not doing what you expected/wanted. Binomial data is expected to be counts. If your observations are `[0,1,1,0,0,1,1]`, then those ones and zeros are treated as counts of heads generated by sequences of flips, not as the outcomes of individual flips. PyMC doesn’t know that you want to observe the sum.

Ah okay, I used Bernoulli instead of Binomial with the vector input and it worked. Sounds like if I want to pass a vector to Binomial, I’d need to supply two: one for k and one for n.