Hi, I have a custom likelihood and I’m trying to determine the posterior probabilty for my parameters , given Uniform priors. I’ve written (trying to follow https://arxiv.org/pdf/1507.08050.pdf):
with Model() as paper:
#priors
m = Uniform('m',0.,1.)
q = Uniform('q',0.,5.)
sigmay = Uniform('sigmay',0.,1.)
# deterministic rule
logEpeak_i=(q)+(m*logEiso)
#likelihood definition
def likelihoodMCMC(m,q,sigmay,logEiso,logEpeak_i,logErrEiso,logErrEpeak_i):
return np.exp(0.5*np.sum(np.log(np.divide(1,2*np.pi*(sigmay**2 + logErrEpeak_i**2 + (m*logErrEiso)**2))) - np.divide((logEpeak_i - m*logEiso - q)**2,sigmay**2 + logErrEpeak_i**2 + (m*logErrEiso)**2)))
Data likelihood
obs_peaks=DensityDist('obs_peak', likelihoodMCMC,observed=(logEiso,logEpeak_i,logErrEiso,logErrEpeak_i))
Obtaining the following error:
TypeError: likelihoodMCMC() missing 6 required positional arguments: 'q', 'sigmay', 'logEiso', 'logEpeak_i', 'logErrEiso', and 'logErrEpeak_i'
while, changing the last part in:
obs_peaks=DensityDist('obs_peak', likelihoodMCMC(m,q,sigmay,logEiso,logEpeak_i,logErrEiso,logErrEpeak_i),observed=(logEiso,logEpeak_i,logErrEiso,logErrEpeak_i))
I obtain the following:
TypeError: sum() got an unexpected keyword argument 'out'
Could you suggest me something, please?
Thank you in advance