Where \(g\) is the observed proportion and \(e\) is the expected proportion, \(n\) is the sample size and \(d_{eff}\) is Extra deff:
\[\begin{align} z = \frac{g - e}{\sqrt{d_{eff}g(1-g)/n}}\end{align}\]
where \(p \approx 2(1-\Phi(|z|)=\) if \(g \ne e\) and NaN otherwise.
An alternative version of this test uses Bessel's correction:
\(z = \frac{p - e}{\sqrt{d_{eff}g(1-g)/(n-1)}}\)