Classical and Bayesian approaches to parameter estimation are often compared. See, for example What's the difference between a confidence interval and a credible interval?
What I cannot find is "the Bayesian version" of the following result.
Consider a confidence interval as a prediction for the next sample drawn from a normal distribution, and the probability of being wrong is alpha
. No assumptions about the mean and the variance are needed.
Here is a proof. After observing $z_1$, ..., $z_n$, the sample mean and the sample variance are
$$m = \frac{1}{n}\sum_{i = 1}^{n} z_i, \quad s^2 = \frac{1}{n} \sum_{n = 1}^{n} (z_i - m)^2$$.
The random variable $$ \frac{z_{n + 1} - m}{s} \sqrt{\frac{n + 1}{n}} $$
has $t$-distribution with $n - 1$ degrees of freedom and $z_{n + 1}$ will be in the interval
$$m \pm t^{\alpha/2}_{n - 1} s\sqrt{\frac{n}{n + 1}}$$.
with probably $1 - \alpha$, where $t^{\alpha/2}$ is the value of percent point function (inverse of cdf) for $t$-distribution.
And a demonstration in python
#!/usr/bin/python3
import math
import random
import scipy.stats
import statistics
mu = 1.0
sigma = 1.0
alpha = 0.20
N = 1000
def rnd():
return random.gauss(mu, sigma)
def interval(z):
n = len(z) + 1
m = statistics.mean(z)
s = statistics.stdev(z)
t = scipy.stats.t.ppf(1 - alpha/2, n - 2)
d = t * s * math.sqrt(n/(n - 1))
return m - d, m + d
z = [rnd(), rnd()]
wrong = 0
for i in range(N):
x, y = interval(z)
z0 = rnd()
wrong += not x < z0 <= y
z.append(z0)
print(wrong/N)
References
Fisher, R. A. (1935). The fiducial argument in statistical inference. Annals of eugenics, 6(4), 391-398. https://doi.org/10.1111/j.1469-1809.1935.tb02120.x
Shafer, G., & Vovk, V. (2008). A Tutorial on Conformal Prediction. Journal of Machine Learning Research, 9(3) (section 2.1)