Tomorrow, for the final lecture of the Mathematical Statistics course, I will try to illustrate – using Monte Carlo simulations – the difference between classical statistics, and the Bayesien approach.
The (simple) way I see it is the following,
- for frequentists, a probability is a measure of the the frequency of repeated events, so the interpretation is that parameters are fixed (but unknown), and data are random
- for Bayesians, a probability is a measure of the degree of certainty about values, so the interpretation is that parameters are random and data are fixed
Or to quote Frequentism and Bayesianism: A Python-driven Primer, a Bayesian statistician would say “given our observed data, there is a 95% probability that the true value of falls within the credible region” while a Frequentist statistician would say “there is a 95% probability that when I compute a confidence interval from data of this sort, the true value of will fall within it”.
To get more intuition about those quotes, consider a simple problem, with Bernoulli trials, with insurance claims. We want to derive some confidence interval for the probability to claim a loss. There were = 1047 policies. And 159 claims.
Consider the standard (frequentist) confidence interval. What does that mean that
is the (asymptotic) 95% confidence interval? The way I see it is very simple. Let us generate some samples, of size , with the same probability as the empirical one, i.e. (which is the meaning of “from data of this sort”). For each sample, compute the confidence interval with the relationship above. It is a 95% confidence interval because in 95% of the scenarios, the empirical value lies in the confidence interval. From a computation point of view, it is the following idea,
> xbar <- 159
> n <- 1047
> ns <- 100
I generate 100 samples of size . For each sample, I compute the mean, and the confidence interval, from the previous relationship
> fIC=function(x) mean(x)+c(-1,1)*1.96*sqrt(mean(x)*(1-mean(x)))/sqrt(n)
Then we plot all those confidence intervals. In red when they do not contain the empirical mean
Now, what about the Bayesian credible interval ? Assume that the prior distribution for the probability to claim a loss has a distribution. We’ve seen in the course that, since the Beta distribution is the conjugate of the Bernoulli one, the posterior distribution will also be Beta. More precisely
Based on that property, the confidence interval is based on quantiles of that (posterior) distribution
What does that mean, here, that we have a 95% credible interval. Well, this time, we do not draw using the empirical mean, but some possible probability, based on that posterior distribution (given the observations)
> pk <- rbeta(ns,1+xbar,1+n-xbar)
In green, below, we can visualize the histogram of those values
> hist(pk,prob=TRUE,col="light green",
And here again, let us generate samples, and compute the empirical probabilities,
Here, there is 95% chance that those empirical means lie in the credible interval, defined using quantiles of the posterior distribution. We can actually visualize all those means : in black the mean used to generate the sample, and then, in blue or red, the averages obtained on those simulated samples,
More details and exemple on Bayesian statistics, seen with the eyes of a (probably) not Bayesian statistician in my slides, from my talk in London, last Summer,