In this article, the Gaussian Conjugate Priors will be used to compute the Posterior distribution for the some online dataset (1D and 2D) following Gaussian Distribution.
First, a \(N(\mu_0,\sigma_0)\) prior is chosen to model the unknown mean \(\mu\) variable of the data, while assuming the data variance \(\sigma^2\) as fixed.
Then a few i.i.d. samples are drawn from a Gaussian distribution the prior belief about the mean \(\mu\) is updated, \(X_i \sim N(\mu, \sigma^2)\)m with prior \(\mu \sim N(\mu_0, \sigma_0)\).
The posterior probability distribution is also a Gaussian distribution as shown in the figure below from the videos of professor Herbert Lee.
Then the recursive Bayesian updates and the prior and posterior hyper-parameters and the means are updated as and when a new datapoint is received. Also, the frequentist’s MLE and 95% confidence interval are computed, along with the Bayesian 95% credible interval.
The following animation shows the results of simulation of 50 such data samples, starting with the prior \(N(0,10)\).
The left bottom plot visualizes historgram of the data generated.
Every time a new datapoint is received, the prior belief is updated.
The right bottom table represents the summary statistics. Prior and Posterior means (of the arrival rate) respectively correspond to the previous and updated beliefs about the mean of the data.
The next animation shows the same results (with contours) modeling a set of 2D Gaussian samples.