# Two sample $t$ test - equal variances not assumed

This page offers all the basic information you need about the two sample $t$ test - equal variances not assumed. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find *p * values, SPSS how-to’s and more.

To compare the two sample $t$ test - equal variances not assumed with other statistical methods, go to Statkat's or practice with the two sample $t$ test - equal variances not assumed at Statkat's

##### Contents

- 1. When to use
- 2. Null hypothesis
- 3. Alternative hypothesis
- 4. Assumptions
- 5. Test statistic
- 6. Sampling distribution
- 7. Significant?
- 8. Approximate $C\%$ confidence interval for $\mu_1 - \mu_2$
- 9. Visual representation
- 10. Example context
- 11. SPSS
- 12. Jamovi

##### When to use?

Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables. The two sample $t$ test - equal variances not assumed requires the following variable types:

Independent/grouping variable: One categorical with 2 independent groups | Dependent variable: One quantitative of interval or ratio level |

Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).

If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.

##### Null hypothesis

The two sample $t$ test - equal variances not assumed tests the following null hypothesis (H_{0}):

_{0}: $\mu_1 = \mu_2$

Here $\mu_1$ is the population mean for group 1, and $\mu_2$ is the population mean for group 2.

##### Alternative hypothesis

The two sample $t$ test - equal variances not assumed tests the above null hypothesis against the following alternative hypothesis (H_{1} or H_{a}):

_{1}two sided: $\mu_1 \neq \mu_2$

H

_{1}right sided: $\mu_1 > \mu_2$

H

_{1}left sided: $\mu_1 < \mu_2$

##### Assumptions

Statistical tests always make assumptions about the sampling procedure that was used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).

The two sample $t$ test - equal variances not assumed makes the following assumptions:

- Within each population, the scores on the dependent variable are normally distributed
- Group 1 sample is a simple random sample (SRS) from population 1, group 2 sample is an independent SRS from population 2. That is, within and between groups, observations are independent of one another

##### Test statistic

The two sample $t$ test - equal variances not assumed is based on the following test statistic:

$t = \dfrac{(\bar{y}_1 - \bar{y}_2) - 0}{\sqrt{\dfrac{s^2_1}{n_1} + \dfrac{s^2_2}{n_2}}} = \dfrac{\bar{y}_1 - \bar{y}_2}{\sqrt{\dfrac{s^2_1}{n_1} + \dfrac{s^2_2}{n_2}}}$Here $\bar{y}_1$ is the sample mean in group 1, $\bar{y}_2$ is the sample mean in group 2, $s^2_1$ is the sample variance in group 1, $s^2_2$ is the sample variance in group 2, $n_1$ is the sample size of group 1, and $n_2$ is the sample size of group 2. The 0 represents the difference in population means according to the null hypothesis.

The denominator $\sqrt{\frac{s^2_1}{n_1} + \frac{s^2_2}{n_2}}$ is the standard error of the sampling distribution of $\bar{y}_1 - \bar{y}_2$. The $t$ value indicates how many standard errors $\bar{y}_1 - \bar{y}_2$ is removed from 0.

Note: we could just as well compute $\bar{y}_2 - \bar{y}_1$ in the numerator, but then the left sided alternative becomes $\mu_2 < \mu_1$, and the right sided alternative becomes $\mu_2 > \mu_1$.

##### Sampling distribution

Sampling distribution of $t$ if H_{0}were true:

Approximately the $t$ distribution with $k$ degrees of freedom, with $k$ equal to

$k = \dfrac{\Bigg(\dfrac{s^2_1}{n_1} + \dfrac{s^2_2}{n_2}\Bigg)^2}{\dfrac{1}{n_1 - 1} \Bigg(\dfrac{s^2_1}{n_1}\Bigg)^2 + \dfrac{1}{n_2 - 1} \Bigg(\dfrac{s^2_2}{n_2}\Bigg)^2}$

or

$k$ = the smaller of $n_1$ - 1 and $n_2$ - 1

First definition of $k$ is used by computer programs, second definition is often used for hand calculations.

##### Significant?

This is how you find out if your test result is significant:

Two sided:- Check if $t$ observed in sample is at least as extreme as critical value $t^*$ or
- Find two sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$

- Check if $t$ observed in sample is equal to or larger than critical value $t^*$ or
- Find right sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$

- Check if $t$ observed in sample is equal to or smaller than critical value $t^*$ or
- Find left sided $p$ value corresponding to observed $t$ and check if it is equal to or smaller than $\alpha$

##### Approximate $C\%$ confidence interval for $\mu_1 - \mu_2$

$(\bar{y}_1 - \bar{y}_2) \pm t^* \times \sqrt{\dfrac{s^2_1}{n_1} + \dfrac{s^2_2}{n_2}}$where the critical value $t^*$ is the value under the $t_{k}$ distribution with the area $C / 100$ between $-t^*$ and $t^*$ (e.g. $t^*$ = 2.086 for a 95% confidence interval when df = 20).

The confidence interval for $\mu_1 - \mu_2$ can also be used as significance test.

##### Visual representation

##### Example context

The two sample $t$ test - equal variances not assumed could for instance be used to answer the question:

Is the average mental health score different between men and women?##### SPSS

How to perform the two sample $t$ test - equal variances not assumed in SPSS:

Analyze > Compare Means > Independent-Samples T Test...- Put your dependent (quantitative) variable in the box below Test Variable(s) and your independent (grouping) variable in the box below Grouping Variable
- Click on the Define Groups... button. If you can't click on it, first click on the grouping variable so its background turns yellow
- Fill in the value you have used to indicate your first group in the box next to Group 1, and the value you have used to indicate your second group in the box next to Group 2
- Continue and click OK

##### Jamovi

How to perform the two sample $t$ test - equal variances not assumed in jamovi:

T-Tests > Independent Samples T-Test- Put your dependent (quantitative) variable in the box below Dependent Variables and your independent (grouping) variable in the box below Grouping Variable
- Under Tests, select Welch's
- Under Hypothesis, select your alternative hypothesis