The test statistic is:
X 2 = − 2 ∑ i = 1 k log p i {\displaystyle X^{2}=-2\sum _{i=1}^{k}\log p_{i}}
where: