# Complex Samples Z-Test of a Proportion

Where ${\displaystyle g}$ is the observed proportion, ${\displaystyle e}$ is the expected proportion, ${\displaystyle s_{p}}$ is the estimated Standard Error of the observed proportion and ${\displaystyle n}$ is the sample size,
${\displaystyle n}$ is the sample size:
${\displaystyle z={\frac {g-e}{s_{p}}}}$
where ${\displaystyle p=2(1-\Phi (|z|))}$ if ${\displaystyle g\neq e}$ and NaN otherwise.