Thank you so much for your quick reply.
Before the 1st post, I tried
def _logp(obs, mu, sigma):
z = (obs-mu)/sigma
return -at.sum(z**2) / 2 - at.log(2*np.pi*sigma**2) /2
and had a similarly biased posterior. But I should have included the normalization constant inside the at.sum() … silly mistake.
Now, both
return at.sum(-z**2 / 2 - at.log(sigma) )
and
return -z**2 / 2 - at.log(sigma)
work fine. Thank you!