QQ-plot is a visual tool (not a formal [[Statistical Test]]) to assess how well a set of observations fits a hypothesized distribution $F_0$ under the null hypothesis $H_0$:
$ H_0: F=F_0 $
**Concept:**
The [[Cumulative Density Function|CDF]] $F$ maps observations $X$ to probabilities on the interval $[0,1]$.
$F: X \mapsto [0,1] $
The inverse CDF (quantile function) maps probabilities $[0,1]$ back into the original scale of the observations.
$ F^{-1}: [0,1] \mapsto X $
Using these mappings, a QQ-plot compares the *theoretical quantiles* (from $F_0$) to the *empirical quantiles* (from the data).
**Construct a QQ-Plot:**
1. *Sort the data:* Arrange the observed values in ascending order $X_{(1)} \le \cdots \le X_{(n)}$.
2. *Compute the theoretical quantiles:* For each observation $X_{(i)}$ calculate the corresponding theoretical quantile using the inverse CDF of $F_0$.
$ F^{-1}\Big(\frac{i}{n}\Big)$
3. *Create value pairs:* Pair the theoretical quantiles with the observed values:
$
\left(F^{-1}\big(\frac{1}{n}\big), X_{(1)}\right), \, \, \ldots ,
\left(F^{-1}\big(\frac{i}{n}\big), X_{(i)}\right), \, \, \ldots , \, \, \left(F^{-1}\big(\frac{n-1}{n}\big), X_{(n-1)}\right)
$
>[!note:]
>It is usually convention, to put the theoretical distribution on the x-axis, and the actual observations onto the y-axis.
![[qq-plots-1.png|center|400]]
**Patterns of QQ-Plots:**
![[qq-plots-2.png]]