What data source will you be using?
The second step in choosing our samples involves selecting a categorical variable that we will split the samples from:
With the categorical variable set, we now choose the 2 samples we would like to analyse:
Finally, we select the dependent variable. This is the variable that each obervation in the samples are being measured against.
Warning: Sample 1 and Sample 2 should be different.
Enter data into the text box below for each sample.
Sample 1:
Sample 2:
Warning: You must have at least two unique values in your manually specified data.
In order to proceed, you must select some data to act as your sample.
Similar to the 1-sample tests, we will be using the box model to represent the null hypothesis. The key difference here, however, is that we don't have input any values. The null hypothesis is set by default! Take some time to read the points below to ensure you understand why the boxes are arranged as they are.
The first thing you may wonder is why we have two box models for a 2-sample t-test. Unlike the 1-sample t-test, which only had ONE sample,
the 2-sample t-test has TWO samples, and so we need to have two box models to represent each sample.
More concretely, these 2 samples are different, and so they are likely to come from slightly different distributions. Hence, we need to have
2 different box models (note that the standard deviation \(s\) for each is different). The samples are not coming from the same distribution.
For a 2-sample t-test, under the null hypothesis, we claim that the mean of sample 1 (\(\mu_1\)) is equal to the mean of sample 2
(\(\mu_2\)). More formally, we write this as \(H_0: \mu_1 = \mu_2\).
Hence, the mean of sample 1 (\(\mu_1\)) is equal to the mean of sample 2 (\(\mu_2\)).
Likewise, the mean of sample 2 (\(\mu_2\)) is equal to the mean of sample 1 (\(\mu_1\)).
In case you are confused about where all the values for each box model have come from, these come from the sample 1 and sample 2 data that you specified above. In particular:
Specify what type of alternate hypothesis you will be using below:
Null Hypothesis
\( H_0: \) \( \mu_1 = \mu_2 \)
Alternate Hypothesis
For the hypothesis test to be valid, we need to check the following assumptions:
The first assumption is that our 2 samples are independent and randomly chosen.
How do we check? We check by investigating the experimental setup.
For example, consider we were doing an experiment where we were interested in the effect of a treatment on resting heart rate,
and had a control and treatment group. Independence would be violated if people in the sample were related (family members would share
similar genetics, and similar resting heart rates). Randomness could be violated if we only choose people with certain characteristics for
one of the groups, such as healthy people for the treatment group. It could appear the treatment is reducing these people's heart rate,
but it is actually that they are healthy so already have a comparably low heart rate.
The second assumption is that each sample's means are normally distributed.
How do we check?
Firstly, it is important to realise that here, we want the distribution of sample means to be normally distributed. Hence, we do not
necessarily need the underlying data to be normally distributed, as we can rely on the Central Limit Theorem (CLT) to apply.
That being said, knowing whether the CLT applies or not is not straightforward. A common convention used online is that if there are
more than 30 points in the sample, then the CLT will 'kick in'. But this is not necessarily true! If the underlying distribution is very skewed
and/or asymmetric, then you will likely need many more than 30 points. Hence, checking whether the underlying data is nearly normally distributed
will give us some insight. This is because if data is nearly normally distributed, you need fewer points for the CLT to 'kick in'.
There are a few different ways that you can check whether the underlying data is normally distributed. For each of the following, you must
look at both samples separately:
The third assumption is that sample 1 and sample 2's population spreads are equal.
How do we check?
There are 2 main ways we can check this visually:
Unlike the other tests, for a 2-sample t-test, if this assumption is not satisfied, we can make an easy change to how the test statistic is calculated to relax this assumption. If the assumption is not satisfied, we can move from a regular 2-sample t-test to a Welch 2-sample t-test. In the next section, you will determine whether we do a Welch test or not!
As mentioned in assumption 3, an assumption of a standard 2-sample t-test with equal variance is that the population spreads of sample 1 and sample 2 are equal. However, if this assumption is not satisfied, it is not bad news! We can instead use a different type of 2-sample t-test which relaxes this assumption. In particular, the two types of test we can use include:
Your goal is to decide whether we will use a 2-sample t-test with equal variance, or a Welch 2-sample t-test. To make this determination, use a combination of the outputs below to make your decision.
Indicators that the spreads are similar:
Indicators that the spreads are similar:
Indicators that the spreads are similar:
Toggle the switch below to determine whether the spread is the same or not.
Step 1) Calculate Expected Value (SE) and Standard Error (SE)
Step 2) Test Statistic Calculation
Step 1) What is your significance level?
\( \alpha = \)
Error: The value for α must be between 0 and 1.
Step 2) Final Conclusion
A confidence interval in a two-sample t-test shows the range of plausible values for the difference between the population means at the chosen confidence
level. If 0 falls outside this range, we reject the null hypothesis.
We can also use the confidence interval to guide hypothesis testing: if 0 (representing no difference between the two population means) does not lie within
the confidence interval, then we reject the null hypothesis. If 0 does lie within the interval, we do not reject the null.
Step 1) What is your confidence level?
\( \alpha = \)
Error: The value for confidence level must be between 0 and 1.
Step 2) Final Conclusion