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

Where ${\bar {x}}_{t}$ is the mean in the total sample and ${\bar {x}}_{s}$ is the mean 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$ :

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

where:

$p=2\Pr(t_{v}\geq |t|)$ ,
$s_{{\bar {x}}_{k}}^{2}={\frac {d_{eff}s_{x_{k}}^{2}}{n_{k}}}$ ,
$n_{k}=n_{t}-n_{g}$ ,
$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}}$ ,
${\bar {x}}_{k}={\frac {{\bar {x}}_{t}-w_{s}{\bar {x}}_{s}}{1-w_{s}}}$ ,
$s_{{\bar {x}}_{s}}$ is the Standard Error of ${\bar {x}}_{s}$ ,
$v={\frac {({\frac {s_{{\bar {x}}_{s}}^{2}}{n_{s}}}+{\frac {s_{{\bar {x}}_{s}}^{2}}{n_{k}}})^{2}}{{\frac {({\frac {s_{{\bar {x}}_{s}}^{2}}{n_{s}}})^{2}}{n_{s}-b}}+{\frac {({\frac {s_{{\bar {x}}_{s}}^{2}}{n_{k}}})^{2}}{n_{k}-b}}}}$ , or, if Weights and significance is set to Un-weighted sample size in tests (see Weights, Effective Sample Size and Design Effects), $v=n_{t}-2b$ $b$ is 1 if Bessel's correction is selected for Proportions in Statistical Assumptions and 0 otherwise,
$s_{x_{t}}^{2}$ and $s_{x_{s}}^{2}$ are the estimated standard deviations for the total sample and sub-groups respectively,
$s_{{\bar {x}}_{t}}^{2}$ and $s_{{\bar {x}}_{s}}^{2}$ are the estimated standard error of the means for the total sample and sub-groups respectively,
$d_{eff}$ is Extra Deff, and
$w_{s}$ is the proportion of the Population represents by the sub-group.