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 prediction interval 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

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


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)

Jaynes, E. T., & Kempthorne, O. (1976). Confidence intervals vs Bayesian intervals. In Foundations of probability theory, statistical inference, and statistical theories of science (pp. 175-257). Springer, Dordrech. https://doi.org/10.1007/978-94-010-1436-6_6

  • 1
    $\begingroup$ The "result" you quote is incorrect: that's not what a confidence interval means. See stats.stackexchange.com/questions/16493. $\endgroup$
    – whuber
    May 9 at 15:43
  • $\begingroup$ @whuber Could you, please, elaborate. I added a prof of the results which is one step from a definition of a confidence interval. $\endgroup$
    – slitvinov
    May 9 at 17:20
  • $\begingroup$ Doesn't the link provide sufficient elaboration of the distinction between confidence and prediction intervals? The interval in your code is a prediction interval, not a confidence interval. $\endgroup$
    – whuber
    May 9 at 17:54
  • $\begingroup$ @whubber the link you give is about regression. $\endgroup$
    – slitvinov
    May 9 at 17:55
  • 1
    $\begingroup$ What you describe is the prediction interval for $z_{n+1}$. It's equal to the corresponding Bayesian credible interval for the same quantity if using an improper uniform prior on $\mu$ and an independent improper scale prior $\propto 1/\sigma^2$ on $\sigma^2$. $\endgroup$ May 9 at 19:14

What you describe is a prediction interval for $z_{n+1}$. This prediction interval happen to be equal to the corresponding Bayesian credible interval for the same quantity based on the predictive posterior density of $z_{n+1}$ (a scaled, shifted $t$-distribution) if using an improper uniform prior on $\mu$ and an improper scale prior $\propto 1/\sigma^2$ on $\sigma^2$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.