Paired t-Test


Input Sample Data

In a paired t-test, we are dealing with paired data. This is where each element in our study has a measurement recorded under two different conditions. We can then find the difference between the paired data to reduce the values into a single data sample. But before doing this, we first have to choose a data set to analyse.


What data source will you be using?


Warning: Other than the 'SleepStudy' data set, the other data sets are synthetic (made up) data.

Now we need to select what data we want to be in condition 1, and what to be in condition 2. The paired difference will be condition 2 - condition 1.


Warning: Condition 1 and condition 2 should be different.


Enter data into the text box below for each sample.

  • All values must be numeric, and numbers should contain no spaces or any characters other than a '.' for a decimal place.
  • Each value must be on it's own line, or comma seperated.
  • As this is paired data, there must be the same number of values in each textbox.
  • Don't forget to press 'Upload' once you are finished!

Condition 1:

Condition 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.




The 'NULL' Hypothesis - Setting up the Box

We are going to use the box model to represent our null hypothesis.

The only things we need to do to set up the box in this test is to specify the sample data (which we have already done) and specify the null hypothesis.

For a paired t-test, the null hypothesis is that the difference between the average of condition 2 (\(\mu_2\)) and condition 1 (\(\mu_1\)) is equal to some value we specify. We write \(\mu_2 - \mu_1 \) as \(\mu_d\), where \(d\) stands for difference.

Hence, the null hypothesis is that the average population mean difference between condition 2 and condition 1 is equal to some value which we set below.

\( H_0: \) \(\mu_d = \)

In case you are confused about where all the values in the diagram have come from, these come from the sample data that you previously specified. In particular:

  • \(s \) represents the sample standard deviation. Unlike the 1-sample z-test which requires that the population standard deviation is known, the 1-sample t-test removes this assumption, instead using the standard deviation of the sample and then later the t-distribution to determine the p-value.
  • The value for \(n \) comes from the number of values in the sample chosen above.
  • The observed value (\(\text{OV} \)) comes from the mean of the sample chosen above.



The Alternate Hypothesis

Specify what type of alternate hypothesis you will be using below:


Null Hypothesis

Alternate Hypothesis




Assumptions

For the hypothesis test to be valid, we need to check the following assumptions:

The first assumption is that our sample is independent and randomly chosen.

How do we check? We check by investigating the experimental setup.

For example, consider we were investigating data for a sample involving human participants. We could read the accompanying scientific publication to understand the methodology they used to gather the people in the sample.

The second assumption is that the sample means follow a normal distribution.

How do we check?

Idea 1: Large n
Recall that the central limit theorem tells us that if we take a sufficiently large number of draws from the box, then the sample means will approximately follow a normal distribution. If confused, please do the exerice at Fundamentals > Box Model Part 2.

  • Recall that the central limit theorem tells us that if we take a sufficiently large number of draws from the box, then the sample means will approximately follow a normal distribution. If confused, please do the exerice at Fundamentals > Box Model Part 2.
  • One way to gauge whether the central limit theorem holds or not is to see how large our sample is (this is indicated by the "n" in the box model above).
  • Many textbooks will say that you can say that you can use the rule of thumb that the central limit theorem will apply if we have 30 or more draws. BEWARE - this is not always true! If the distribution of the values is very skewed, you will need much more than 30 draws!

Idea 2: QQ-plot, Boxplot and Histogram
We learnt that if our data has some specific properties, then required a smaller value for n for the CLT to apply. In particular...

  • (QQ-plot) If the sample closely follows the QQ line, it suggests the data is normally distribued. Data that is normally distributed requires far less point for the CLT to apply.
  • (Boxplot and Histogram) If the data is symmetric, less points are required for the CLT. These plots can also be used to indicate whether the data appears to be normally distributed.



Test Statistic

Step 1) Calculate Expected Value (SE) and Standard Error (SE)

Step 2) Test Statistic Calculation




p-value



Conclusion (p-value)

One way to tell whether we accept or reject the null hypothesis is to observe whether our p-value is below or above the significance level.

Step 1) What is your significance level?

\( \alpha = \)

Error: The value for α must be between 0 and 1.

Step 2) Final Conclusion




Conclusion (Confidence Interval)

A confidence interval in a 1-sample z-test shows the range of population means that are plausible at the chosen confidence level, and if the hypothesized mean falls outside this range, the null hypothesis is rejected.

We can also use a confidence interval to tell us whether we should accept or reject the null hypothesis. If the expected value DOES NOT lie within the confidence interval, then we reject the null hypothesis.

Step 1) What is your confidence level?

\( \alpha = \)

Error: The value for confidence level must be between 0 and 1.

Step 2) Final Conclusion