In pm.DensityDist
, observed
are the parameters and data you pass to the custom log-likelihood function.
If you want to make it more clear, you can also rewrite the logp function like this:
# Log likelihood function
def logp_function(parameters):
def logp(observed):
some_scaler = some_function(parameters, observed)
return some_scaler
return logp # returns a function
In your case, it would be:
def likelihoodMCMC(m, q, sigmay):
def logp(value):
return tt.exp(0.5*tt.sum(
tt.log(1/(2*np.pi*(sigmay**2 + value[3]**2 + (m*value[2])**2))) -
(value[1] - m*value[0] - q)**2/(sigmay**2 + value[3]**2 + (m*value[2])**2)))
return logp
where value = (logEiso, logEpeak_i, logErrEiso, logErrEpeak_i)
Then you can call it as:
with pm.Model() as model:
...
obs_peaks = pm.DensityDist('obs_peak', likelihoodMCMC(m,q,sigmay),
observed=(logEiso, logEpeak_i, logErrEiso, logErrEpeak_i))