The understanding of Logp

I am trying to understand the usage of lopg and write the lopg myself. There seems to be no specific formula of lopg in the document. As far as I am concerned, the logp seems to be the log of probability density function. Is that true? I’ve done a test to verify my understanding of the logp.

For norm distribution, the logp can be


but I want to write the specific formula myself like this:

def logp(value):
    return tt.sum(-(value-muc[Siteid])**2/2/sigmac**2)

with pm.Model()…

Its result should be the same as that of

c = pm.Normal('c',mu=muc[Siteid],sd=sigmac, observed=FS)

So, take the norm distribution for example, what the logp should be?
Thanks a lot.

“**” can not be shown, I use “^” instead.

Your set up seems correct to me. but you need to change your formula:

def logp(value):
    return (-sigmac**-2 * (value - muc[Siteid])**2 + tt.log(sigmac**-2 / np.pi / 2.)) / 2.