Dear OT users, Yesterday I got quick and successful help with creating a mixture distribution. Thanks.
This time I try to implement a rather simple Bayesian updating of continuous distributions with OT. Posterior = (Prior.pdf * Likelihood.pdf) / (Integral(Prior.pdf * Likelihood.pdf)) But my many attempts failed. I hope have an answer. Here follows a scipy example of what I want to achieve: #============================================================================== # beginning of code #============================================================================== import numpy as np from scipy.stats import norm from matplotlib import pyplot as plt x = np.linspace(-20, 20, 10000) Prior = norm(6., .8) Likelihood = norm(4., 1.2) Posterior_pdf = Prior.pdf(x) * Likelihood.pdf(x) / np.sum(Prior.pdf(x) * Likelihood.pdf(x) * (abs(x[0]) + abs(x[-1]))/len(x)) plt.figure() plt.plot(x, Prior.pdf(x), label="Prior") plt.plot(x, Likelihood.pdf(x), label="Likelihood") plt.plot(x, Posterior_pdf, label="Posterior") plt.xlim(0,8) plt.legend(loc = 'best') plt.show() #============================================================================== # end of code #============================================================================== Best regards and thanks, Henning
_______________________________________________ OpenTURNS users mailing list [email protected] http://openturns.org/mailman/listinfo/users
