# Complex Samples Dependent Z-Test - Comparing a Sub-Group Proportion to Total

Where $g_t$ is the proportion in the total sample and $g_s$ is the proportion in the sub-group, $n_t$ and $n_s$ are their respective effective sample sizes, and $w_s$ is the proportion of the total population in sub-group $s$:

$z=\frac{g_t - g_s}{(1 - w_s)\sqrt{d_{eff}(se^2_s + se^2_k)}}$,

where:

$p = 2(1-\Phi(|z|))$.
$g_k = (g_t-g_s w_s)/(1-w_s)$,
$se_k = \sqrt{\frac{g_k(1 - g_k)}{n_t - n_s - b}}$,
$se_g = \sqrt{\frac{g_g(1 - g_g)}{n_s -b}}$,
$b$ is 1 if Bessel's correction is selected for Proportions in Statistical Assumptions and 0 otherwise,
$d_{eff}$ is Extra Deff, and
$w_s$ is the proportion of the Population represents by the sub-group.