MATH 321 – Mathematical Statistics I
November 4, 2025
\[ \DeclareMathOperator*{\argmax}{arg\!max} \newcommand{\dsum}{\displaystyle\sum} \newcommand{\dint}{\displaystyle\int} \]
Recall Bayes’ Theorem, if \(A_i\) for \(i = 1, \dots, n\) are a partition of the sample space: \[ P(A_i \mid B) = \frac{P(B \mid A_i) P(A_i)}{P(B)} = \frac{P(B \mid A_i) P(A_i)}{\sum_{j=1}^n P(B \mid A_j) P(A_j)}. \]
If \(X\) and \(Y\) are discrete random variables, we can easily express conditional probabilities and Bayes’ Theorem using them:
\[ \begin{aligned} P(Y = y \mid X = x) &= \frac{P(X = x \mid Y = y) P(Y = y)}{P(X = x)} \\ &= \frac{P(X = x \mid Y = y) P(Y = y)}{\sum_t P(X = x \mid Y = t) P(Y = t)}. \end{aligned} \]
But what if \(X\) and \(Y\) are continuous?
We can use the conditional density as our analogue for the conditional probability: \[ \begin{aligned} f_{X \mid Y}(x \mid y) &= \frac{f_{Y \mid X}(y \mid x) f_X(x)}{f_Y(y)} \\ &= \frac{f_{Y \mid X}(y \mid x) f_X(x)}{\dint_{-\infty}^\infty f_{Y \mid X}(y \mid t) f_X(t) \, dt} \end{aligned} \]
Understanding how Bayesian statistics work requires a bit of a shift in how we think about probability, philosophically.
In the standard “frequentist” worldview, probability is the long-run relative frequency of an event. Ifyou run an experiment many times, the proportion of times the event occurs out of the total number of tries will approach the “true” probability.
In the Bayesian framework, probability is instead a degree of subjective belief. We update our beliefs with new data, and adjust our belief accordingly. If I believe that an event is more likely to occur, the probability is that much higher.
We also want to rethink how models and how parameters are thought of.
In the frequentist framework, parameters of a distribution or a model are constants that describe it. It exists, but it is unknown, so we need to estimate it.
To the Bayesian, because we dont know the value of the parameter, it is a random variable.
Because the parameter \(\tilde{\theta}\) is treated as a random variable, it has a distribution, \(g(\tilde{\theta})\).
This is called the prior distribution.
It represents the statistician’s belief about how the parameter is distributed, before we see the data.
It might be an uninformative flat prior, or it might be more specific, fitted to the situation, based on prior research or just a hunch.
Then the data is represented by the likelihood function for our model, \(\mathcal{L}(\tilde{y} \mid \tilde{\theta})\).
This is the probability of getting the data \(\tilde{y}\) with the parameter \(\tilde{\theta}\).
Using Bayes’ Theorem, we can find the posterior distribution, \(g(\tilde{\theta} \mid \tilde{x})\). \[ \begin{aligned} g(\tilde{\theta} \mid \tilde{x}) &= \frac{\mathcal{L}(\tilde{y} \mid \tilde{\theta}) g(\tilde{\theta})}{\dint_{-\infty}^\infty \mathcal{L}(\tilde{y} \mid t) g(t) \, dt} \\ g(\tilde{\theta} \mid \tilde{x}) &\propto \mathcal{L}(\tilde{y} \mid \tilde{\theta}) g(\tilde{\theta}). \end{aligned} \]
The posterior distribution represents our belief in the distribution of the parameters after we incorporate the data.
Because the posterior is a function of the parameter \(\tilde{\theta}\), we can then use it as the prior of the next experiment.
If we choose a prior such that, given a certain likelihood function, the posterior follows the same distribution as the prior, we call that a conjugate prior.
Subjectivity is the most frequent objection to Bayesian methods, as the prior distribution influences the conclusions.
Two scientists may arrive at different conclusions from the same data, .
However, it can be shown that the influence of the prior goes to zero as the sample size increases (for all but the most bone-headed priors).
Suppose we are modeling the election for Mayor of New York City that took place on Tuesday, and namely want to predict the amount of the vote Zohran Mamdani will get. We ask \(100\) likely voters whether they are going to vote for Mamdani, assuming that they are independent Bernoulli trials with probability \(\theta\) of supporting Mamdani. \(62\) of those asked said they will vote Mamdani.
So the likelihood is: \[ \begin{aligned} \mathcal{L}(x_i \mid \theta) &= \prod_{i=1}^{n} \theta^x_1 (1 - \theta)^{1 - x_i} \\ &= \theta^{\sum x_i} (1 - \theta)^{n - \sum x_i}. \end{aligned} \]
Let’s be smart about our prior distribution.
The success probability \(\theta\) can take on any value between \(0\) and \(1\), so we need a distribution with that as the support. Can you think of a good choice?
The Beta distribution should work perfect! \[ g(\theta) = \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) \Gamma(\beta)} \theta^{\alpha - 1} (1 - \theta)^{\beta - 1}. \]
Let’s use a prior distribution of \(\text{Beta}(\alpha = 10, \beta = 10)\).
We only need the part of the posterior density that involves the parameter, so we treat it as “proportional to” rather than equal to.
Because it is a PDF, we can get the constant part by integrating and making sure the full density function integrates to \(1\).
\[ \begin{aligned} g(\theta \mid \tilde{x}) &\propto \mathcal{L}(\tilde{x} \mid \theta) g(\theta) \\ &= \left( \theta^{\sum x_i} (1 - \theta)^{n - \sum x_i} \right) \left( \frac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) \Gamma(\beta)} \theta^{\alpha - 1} (1 - \theta)^{\beta - 1} \right) \\ &\propto \theta^{\sum x_i + \alpha - 1} (1 - \theta)^{n - \sum x_i + \beta - 1} \end{aligned} \]
Notice that if we set \(\alpha^* = \sum x_i + \alpha\) and \(\beta^* = n - \sum x_i + \beta\), then this is of the form \(\theta^{\alpha^* - 1} (1 - \theta)^{\beta^* - 1}\), or matches with the Beta distribution!
Thus, the Beta-Binomial is a conjugate prior pair.
Thus, the posterior for our example is Beta with \(\alpha^* = \sum x_i + \alpha = 62 + 10 = 72\) and \(\beta^* = n - \sum x_i + \beta = 100 - 62 + 10 = 48\).
We can use this to estimate \(\widehat{\theta}\): \[ \widehat{\theta} = E[ \theta \mid \tilde{x} ] = \frac{\alpha^*}{\alpha^* + \beta^*} = \frac{72}{72+48} = \frac{72}{120} = 0.60. \]
We can also use the distribution to get a credible interval (Bayesians don’t make confidence intervals) or hypothesis tests.
If the posterior distribution is known, simulating the model is pretty trivial, R or Python has functions to pull random values from a known distribution.
If the distribution is not of a known family, it can be really hard.
We use algorithms designed to make this easier, namely Markov Chain Monte Carlo samplers.
Some of the most common are the Metropolis-Hastings algorithm or a Gibbs sampler.