# Uncertainty and distribution of a percentile

In a Bayesian analysis (Normal case), it is possible to obtain a posterior distribution of the mean and variance. We can also obtain quantiles, median,... of these distributions. My question now is: is it possible to obtain the quantiles of the model itself (so not of the model parameters, but of the model using those parameters). And is it possible to obtain a distribution of a quantile (for instance, a 95% quantile) taking into account the uncertainty of the mean and the variance.

$$y \sim N(\mu, \sigma)$$ $$\mu \sim N(0, 10000)$$ $$\sigma \sim G(0.0001, 0.0001)$$

So I want to calculate the percentile of the Gaussian model of $$y$$, taking into account the variability of $$\mu$$ and $$\sigma$$, and I want to explore the uncertainty about that percentile.

## 1 Answer

Compared to the difficulty of getting confidence intervals for quantiles in the frequentist setting, Bayes handles this most elegantly. It is easiest to do by taking a few thousand draws of the bivariate posterior distribution of $$\mu$$ and $$\sigma$$, computing the quantile, e.g., $$\mu + \sigma \Phi^{-1}(q)$$, and analyzing the distribution of these derived quantities. All uncertainties are taken into account.

• Bayes isn't the only option here. There are frequentist algorithms such as divide and conquer which sample and resample, via draws based on bootstrapping or jacknife, from the empirical distribution of the data, building many mini-models. The results of these mini-models can form a distribution around the quantile. E.g., khanacademy.org/computing/computer-science/algorithms/… also see Wang, Chun & Chen, Ming-Hui & Schifano, Elizabeth & Wu, Jing & Yan, Jun. (2015) A Survey of Statistical Methods and Computing for Big Data
– user234562
Commented Nov 19, 2020 at 13:19
• But you will be surprised when you compute both the left and right tail non-coverage probability for confidence intervals that these methods are often not as accurate as you need. The Bayesian solution is exact at all sample sizes. For the bootstrap you may need to very time-consuming double bootstrap to get accurate enough confidence intervals. Commented Nov 19, 2020 at 13:28
• Is the Bayesian solution exact? My understanding is that any and all iterative routines change their results as a function of the number of times random draws are taken. In that sense both approaches are approximating. Not only that, both approaches are CPU intensive.
– user234562
Commented Nov 19, 2020 at 20:10
• I should have said that Bayesian methods are exact to within simulation error. The error goes down as the square root of the number of posterior draws. So just take 8,000 posterior draws and you are usually OK. You would almost never need more than 50,000 posterior draws. Commented Nov 20, 2020 at 12:28
• @FrankHarrell Thank you for your answer. If I use MCMC (I'm using R2Openbugs), can I just take the sampled values of mu and sigma (after the burn-in period) and calculate for each pair the corresponding quantile? Commented Nov 20, 2020 at 14:09