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

Where ${\displaystyle {\bar {x}}_{t}}$ is the mean in the total sample and ${\displaystyle {\bar {x}}_{s}}$ is the mean in the sub-group, ${\displaystyle n_{t}}$ and ${\displaystyle n_{s}}$ are their respective effective sample sizes, and ${\displaystyle w_{s}}$ is the proportion of the total population in sub-group ${\displaystyle s}$:

${\displaystyle z={\frac {{\bar {x}}_{t}-{\bar {x}}_{s}}{(1-w_{s}){\sqrt {s_{{\bar {x}}_{s}}^{2}+s_{{\bar {x}}_{k}}^{2}}}}}}$,

where:

${\displaystyle p=2(1-\Phi (|z|))}$,
${\displaystyle s_{{\bar {x}}_{k}}^{2}={\frac {d_{eff}s_{x_{k}}^{2}}{n_{k}}}}$,
${\displaystyle n_{k}=n_{t}-n_{g}}$,
${\displaystyle s_{x_{k}}^{2}={\frac {s_{x_{t}}^{2}(n_{t}-b)-s_{x_{s}}^{2}(n_{s}-b)-({\bar {x}}_{t}-{\bar {x}}_{s})^{2}n_{s}-({\bar {x}}_{t}-{\bar {x}}_{k})^{2}n_{k}}{n_{k}-b}}}$,
${\displaystyle {\bar {x}}_{k}={\frac {{\bar {x}}_{t}-w_{s}{\bar {x}}_{s}}{1-w_{s}}}}$,
${\displaystyle s_{{\bar {x}}_{s}}}$ is the Standard Error of ${\displaystyle {\bar {x}}_{s}}$,
${\displaystyle b}$ is 1 if Bessel's correction is selected for Proportions in Statistical Assumptions and 0 otherwise,
${\displaystyle s_{x_{t}}^{2}}$ and ${\displaystyle s_{x_{s}}^{2}}$ are the estimated standard deviations for the total sample and sub-groups respectively,
${\displaystyle s_{{\bar {x}}_{t}}^{2}}$ and ${\displaystyle s_{{\bar {x}}_{s}}^{2}}$ are the estimated standard error of the means for the total sample and sub-groups respectively,
${\displaystyle d_{eff}}$ is Extra Deff, and
${\displaystyle w_{s}}$ is the proportion of the Population represents by the sub-group.