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

Where $\displaystyle{ g_t }$ is the proportion in the total sample and $\displaystyle{ g_s }$ is the proportion 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{ t=\frac{g_t - g_s}{(1 - w_s)\sqrt{d_{eff}(se^2_s + se^2_k)}} }$,

where:

$\displaystyle{ p = 2\Pr(t_v \ge |t|) }$,
$\displaystyle{ g_k = (g_t-g_s w_s)/(1-w_s) }$,
$\displaystyle{ se_k = \sqrt{\frac{g_k(1 - g_k)}{n_t - n_s - b}} }$,
$\displaystyle{ se_g = \sqrt{\frac{g_g(1 - g_g)}{n_s -b}} }$,
$\displaystyle{ v = \frac{(\frac{se^2_s}{n_s} +\frac{se^2_k}{n_k} )^2}{\frac{(\frac{se^2_s}{n_s})^2}{n_s-b}+\frac{(\frac{se^2_k}{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), $\displaystyle{ v = n_t - 2b }$
$\displaystyle{ b }$ is 1 if Bessel's correction is selected for Proportions in Statistical Assumptions and 0 otherwise,
$\displaystyle{ d_{eff} }$ is Extra Deff, and
$\displaystyle{ w_s }$ is the proportion of the Population represents by the sub-group.