# Quantiles of the Normal

## Contents

# Quantiles of the Normal¶

Now take a Normal:

and let \(F(x) = p(X \le x)\) be its CDF. The \(q\)-quantile of \(X\) is defined through the solution of the non-linear equation:

Recall that we have managed to express the Normal CDF \(F(x)\) in terms of the standard Normal CDF \(\Phi(z)\):

We can use this to express \(x_q\) in terms of \(z_q\), i.e., the \(q\)-quantile of the standard Normal. We have by substitution in the defining equation of \(x_q\):

By comparing to the defining equation of \(z_q\),

we get that:

or, in terms of \(x_q\):

Alright, so if we know the \(q\)-quantiles of the standard Normal we can get the \(q\)-quantiles of a Normal. The median is trival:

since \(z_{0.5}\).

The \(0.025\)-quantile is:

And the \(0.975\)-quantile is:

So, we can say (95% central credible interval):

\(X\) is between \(\mu - 2\sigma\) and \(\mu + 2\sigma\) with 95% probability.

Similarly, we can find the \(0.001\)-quantile:

and the \(0.999\)-quantile:

which we can use to say (99.8% central credible interval):

\(X\) is between \(\mu - 3\sigma\) and \(\mu + 3 \sigma\) with 99.8% probability.

These are good things to remember, but even if you don’t, you can still use `scipy.stats`

to find quantile and central credible intervals of any Normal:

```
import scipy.stats as st
mu = 5
sigma = 2
X = st.norm(loc=mu, scale=sigma)
x_025 = X.ppf(0.025)
x_975 = X.ppf(0.975)
print('X is between {0:1.2f} and {1:1.2f} with probability 95%'.format(x_025, x_975))
print('Compare to the interval found through the standard normal')
print('** X is between {0:1.2f} and {1:1.2f} with probability 95%'.format(mu - sigma * 1.96,
mu + sigma * 1.96))
```

```
X is between 1.08 and 8.92 with probability 95%
Compare to the interval found through the standard normal
** X is between 1.08 and 8.92 with probability 95%
```

## Questions¶

Modify the code above to find the 99.8% quantile of \(X\).