Skip to main content
Statistics LibreTexts

10.4: Unpaired or Independent Sample t-Test

  • Page ID
    51905
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    In comparing the variances of two populations we have one of two situations :

    1. Homoscedasticity : \(\sigma^2_1 = \sigma^2_2\)
    2. Heteroscedasticity : \(\sigma^2_1 \neq \sigma^2_2\)

    These terms also apply when there are more than 2 populations. They either all have the same variance, or not. This affects how we do an independent sample \(t\)-test because we have two cases :

    1. Variances of the two populations assumed unequal. \(\sigma^2_1 \neq \sigma^2_2\).

    Then the test statistic is :

    \[t_{\rm test} = \frac{(\bar{x}_1 - \bar{x}_2)}{\sqrt{\frac{s^2_1}{n_1} + \frac{s^2_1}{n_2}}}\]

    This is the same formula as we used for the \(z\)-test. To find the critical statistic we will use, when solving problems by hand, degrees of freedom

    \[\begin{equation*} \nu = \min(n_{1}-1,n_{2}-1). \end{equation*}\]

    This choice is a conservative approach (harder to reject \(H_{0}\)). SPSS uses a more accurate

    \[\begin{equation*} \nu = \frac{\left( \frac{s^2_1}{n_1} + \frac{s_2^2}{n_2} \right)^2}{\left[ \frac{\left( \frac{s^2_1}{n_1} \right)}{n_1-1} + \frac{\left( \frac{s^2_2}{n_2} \right)}{n_{2}-1} \right]} \end{equation*}\]

    You will not need to use Equation (10.3), only Equation (10.2). Equation (10.3) gives fractional degrees of freedom. The \(t\) test statistic for this case and the degrees of freedom in Equation (10.3) is know as the Satterwaite approximation. The \(t\)-distributions are strictly only applicable if \(\sigma_{1} = \sigma_{2}\). The Satterwaite approximation is an adjustment to make the \(t\)-distributions fit this \(\sigma_{1} \neq \sigma_{2}\) case.

    2. Variances of the two populations assumed equal. \(\sigma_{1} = \sigma_{2} = \sigma\).

    In this case the test statistic is:

    \[t_{\rm test} = \frac{(\bar{x}_1 - \bar{x}_2)}{\sqrt{\frac{(n_1-1)s^2_1 + (n_2-1)s^2_2}{n_1 + n_2 - 2}} \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}\]

    This test statistic formula can be made more intuitive by defining

    \[\begin{equation*} s_{p} = \sqrt{\frac{(n_1-1)s^2_1 + (n_2-1)s^2_2}{n_1 + n_2 - 2}} \end{equation*}\]

    as the pooled estimate of the variance. \(s_{p}\) is the data estimate for the common population \(\sigma\). \(s_{p}^{2}\) is the weighted mean of the sample variances \(s_{1}^{2}\) and \(s_{2}^{2}\). Recall the generic weighted mean formula, Equation (3.2). The weights are \(\nu_{1} = n_{1}-1\) and \(\nu_{2}=n_{1}-1\); their sum is \(\nu_{1} + \nu_{2} = n_{1} - 1 + n_{2} -1 = n_{1} + n_{2} -2\). In other words

    \[s_{p}^{2} = \frac{\nu_{1} s_{1}^{2} + \nu_{2} s_{2}^{2}}{\nu_{1} + \nu_{2}}\]

    and we can write the test statistic as

    \[\begin{equation*} t_{\rm test}= \frac{(\bar{x}_1 - \bar{x}_2)}{s_{p} \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}}. \end{equation*}\]

    See that \(s_{p} \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}\) is clearly a standard error of the mean.

    10.4.1 General form of the t test statistic

    All \(t\) statistics have the form :

    \[t_{\rm test}= \frac{\mbox{Difference of means}}{\mbox{Standard error of the mean}} = \frac{\mbox{Signal}}{\mbox{Noise}}.\]

    Remember that! Memorizing complicated formulae is useless, but you should remember the basic form of a \(t\) test statistic.

    10.4.2 Two step procedure for the independent samples t test

    We will use the \(F\) test to decide whether to use case 1 or 2. SPSS uses a test called “Levine’s test” instead of the \(F\) test we developed to test \(H_{0}: \sigma^2_1 \neq \sigma^2_2\). Levine’s test also produces an \(F\) test statistic. It is a different \(F\) than our \(F\) but you interpret it in the same way. If the \(p\)-value of the \(F\) is high (larger than \(\alpha\)) then assume \(\sigma_{1} = \sigma_{2}\), if the \(p\)-value is low (smaller than \(\alpha\)) then assume \(\sigma_{1} \neq \sigma_{2}\). In real life, homoscedasticity is almost always assumed because the \(t\)-test is robust to violations of homoscedasticity until one sample set contains twice as many, or more, data points as the other.

    Example 10.4: Case 1 example.

    Given the following data summary :

    \(s_{1}=38\) \(\overline{x}_{1}=191\) \(n_{1}=8\)
    \(s_{2}=12\) \(\overline{x}_{2}=199\) \(n_{2}=10\)

    (Note that \(image\) (s_{2}=12)" title="Rendered by QuickLaTeX.com" height="19" width="164" style="vertical-align: -5px;">. If that wasn’t true, we could reverse the definitions of populations 1 and 2 so that \(image\) 1" title="Rendered by QuickLaTeX.com" height="15" width="66" style="vertical-align: -3px;">.) Is \(\overline{x}_1\) significantly different from \(\overline{x}_2\)? That is, is \(\mu_1\) different from \(\mu_2\)? Test at \(\alpha=0.05\).

    Solution :

    So the question is to decide between

    \[H_{0}: \mu_{1} = \mu_{2} \hspace{.5in} H_{1}: \mu_{1} \neq \mu_{2}\]

    a two-tailed test. But before we can test the question, we have to decide which \(t\) test statistic to use: case 1 or 2. So we need to do two hypotheses tests in a row. The first one to decide which \(t_{\rm test}\) statistic to use, the second one to test the hypotheses of interest given above.

    Test 1 : See if variances can be assumed equal or not.

    1. Hypothesis.

    \[H_0: \sigma^2_1 = \sigma^2_2\hspace{.25in} H_1: \sigma^2_1 \neq \sigma^2_2\]

    (Always use a two-tailed hypothesis when using the \(F\) test to decide between case 1 and 2 for the \(t\) test statistic.)

    2. Critical statistic.

    (from the F Distribution Table)

    (Here we used \(\alpha\) given for the \(t\)-test question. But that is not necessary. You can use \(\alpha = 0.05\) in general; the consequence of a type I error here is small because the \(t\)-test is robust to violations of the assumption of homoscedasticity.)

    3. Test statistic.

    \[F_{\rm test} = F_{7, 9} = \frac{s^2_1}{s^2_2} = \frac{38^2}{12^2} = 10.03\]

    4. Decision.

    \(image\) 4.20" title="Rendered by QuickLaTeX.com" height="14" width="95" style="vertical-align: -2px;"> (\(image\) F_{\rm crit}" title="Rendered by QuickLaTeX.com" height="15" width="89" style="vertical-align: -3px;"> — drawing a picture would be a safe thing to do here as usual) so reject \(H_{0}\).

    5. Interpretation.

    Assume the variances are unequal, \(\sigma_{1}^{2} \neq \sigma_{2}^{2}\), and use the \(t\) test statistic of case 1.

    Test 2 : The question of interest.

    1. Hypothesis.

    \[H_0: \mu_1 = \mu_2\hspace{.25in}H_1: \mu_1 \neq \mu_2\]

    2. Critical statistic.

    From the t Distribution Table, with \(\nu =\min(n_{1}-1,n_{2}-1) = \min(8-1, 10-1) \min(7,9) = 7\), and a two-tailed test with \(\alpha = 0.05\) we find

    \[t_{\rm crit} = \pm 2.365\]

    3. Test Statistic.

    \[\begin{eqnarray*} t & = & \frac{(\bar{x}_1 - \bar{x}_2)}{\sqrt{\frac{s^2_1}{n_1} + \frac{s^2_2}{n_2}}} \\ & = & \frac{(191 - 199)}{\sqrt{\frac{38^2}{8} + \frac{12^2}{10}}} = -0.57 \end{eqnarray*}\]

    The \(p\)-value may be estimated from the t Distribution Table using the procedure given in Chapter 9: from the t Distribution Table, \(\nu = 7\) line, find the values that bracket 0.57. There are none, the smallest value is 0.711 corresponding to \(\alpha = 0.50\). So all we can say is \(image\) 0.50" title="Rendered by QuickLaTeX.com" height="17" width="66" style="vertical-align: -4px;">.

    4. Decision.

    fig87png-300x184.jpg

    \(t_{\rm test} = -0.57\) is not in the rejection region so do not reject \(H_{0}\). The estimate for the \(p\)-value confirms this decision.

    5. Interpretation.

    There is not enough evidence, at \(\alpha = 0.05\) with the independent sample \(t\)-test, to conclude that the means of the populations are different.

    Example 10.5 (Case 2 example) :

    The following data seem to show that private nurses earn more than government nurses :

    Private Nurses Salary Government Nurses Salary
    \(\bar{x}_1 = 26,800\) \(\bar{x}_2 = 25,400\)
    \(s_1 = 600\) \(s_2 = 450\)
    \(n_1 = 10\) \(n_2 = 8\)

    Testing at \(\alpha=0.01\), do private nurses earn more than government nurses?

    Solution :

    First confirm, or change, the population definitions so that \(image\) s_{2}^{2}" title="Rendered by QuickLaTeX.com" height="20" width="55" style="vertical-align: -5px;">. This is already true so we are good to go.

    Test 1 : See if variances can be assumed equal or not. This is a test of \(H_{0}: \sigma_{1}^{2} = \sigma_{2}^{2}\) vs. \(H_{1}: \sigma_{1}^{2} \neq \sigma_{2}^{2}\). After the test we find that we believe that \(\sigma_{1}^{2} = \sigma_{2}^{2}\) at \(\alpha = 0.05\). So we will use the case 2, equal variances, \(t\)-test formula for test 2, the test of interest.

    Test 2 : The question of interest.

    1. Hypothesis.

    \[H_{0}: \mu_{1} \leq \mu_{2}\]

    image \mu_{2}\]" title="Rendered by QuickLaTeX.com">

    (Note how \(H_{1}\) reflects the face value of the data, that private nurses appear to earn more than government nurses in the population — it is true in the samples.)

    2. Critical statistic.

    Use the t Distribution Table, one-tailed test, \(\alpha = 0.01\) (column) and \(\nu = n_{1} + n_{2} -2 = 10+8-2=16\) to find

    \[t_{\rm crit} = 2.583\]

    3. Test statistic.

    \[\begin{eqnarray*} t_{\rm test} &=& \frac{(\bar{x}_1 - \bar{x}_2)}{\sqrt{\frac{(n_1-1)s^2_1 + (n_2-1)s^2_2}{n_1+n_2-2}} \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}} \\ t_{\rm test} &=& \frac{(26,800 - 25,400)}{\sqrt{\frac{(10-1)600^2 + (8-1)450^2}{10+8-2}} \sqrt{\frac{1}{10} + \frac{1}{8}}} \\ t_{\rm test} &=& \frac{1400}{\sqrt{\frac{(9)(360000) + (7)(202500)}{16}}\sqrt{0.1+0.125}} \\ t_{\rm test} &=& \frac{1400}{\sqrt{\frac{3240000 + 1417500}{16}} \sqrt{0.225}} \\ t_{\rm test} &=& \frac{1400}{(\sqrt{291093.75})(\sqrt{0.225})} = 5.47 \end{eqnarray*}\]

    To estimate the \(p\)-value, look at the \(\nu = 16\) line in the t Distribution Table to see if there are a pair of numbers that bracket \(t_{\rm test}=5.47\). They are all smaller than 5.47 so \(p\) is less than the \(\alpha\) associated with the largest number 2.921 whose \(\alpha\) is 0.005 (one-tailed, remember). So \(p < 0.005\).

    4. Decision.

    fig88png-300x122.png

    Reject \(H_{0}\) since \(t_{\rm test}\) is in the rejection region and \((p < 0.005) < (\alpha = 0.01)\).

    image t_{crit} \hspace{.25in} (5.47 > 2.583)\]" title="Rendered by QuickLaTeX.com">

    5. Interpretation.

    From a \(t\)-test at \(\alpha = 0.01\), there is enough evidence to conclude that private nurses earn more than government nurses.


    This page titled 10.4: Unpaired or Independent Sample t-Test is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Gordon E. Sarty via source content that was edited to the style and standards of the LibreTexts platform.