Key Descriptive Notes of Metropolis-Hastings (MCMC) with Bayesian Statistics
From the description of Bayesian theorem in the previous article, observe the situation that the prior assumption is discrete:
Its denominator will be a fixed constant. Therefore, the posterior probability will be positively correlated with the numerator, that is, it will be positively correlated with the “probability multiplied by the prior probability”:
Observe Bayesian theorem, if the prior assumption is continuous:
Its denominator is fixed and can be regarded as a constant, so P(x | y) is positively correlated with the numerator P(y | x) P(x), that is, it has the same relationship with “probability multiplied by prior probability” Positively related:
For continuous assumptions, with infinite values, the distribution of the probability density function (PDF) is used to assume the prior probability.
The probability density function including Standard normal distribution, beta distribution, gamma distribution, exponential distribution, Weibull distribution, Cauchy distribution, Log-normal distribution etc…
In the face of these functions, it is sometimes very difficult to integrate these PDF functions for the denominator in Bayesian theorem; if there is a formula derived from the proof of conjugation, it will be relatively easy to calculate the posterior distribution, if there is no is a headache. On the other hand, we may not know the best parameters of the initial prior distribution and can only start with average or suggested values.
There is a method in Markov chain Monte Carlo (MCMC) that can avoid complex integral operations and face various proposal distributions. This algorithm is: Metropolis–Hastings.
Assuming the formula of Bayesian theorem:
Proceed as follows:
Step1:
First select an initial hypothesis posterior P(x_i)
After multiple rounds of iterations, the number of times of each Step7 is counted as a percentage (the number of occurrences of each hypothesis / the total number of rounds), and a statistical posterior distribution will be formed, which is the posterior distribution we require.