The T.TEST function in Google Sheets is used to compare the mean of two different samples to know if there is a statistical difference between them.
range1 – The first data sample or range of cells the function examines for the t-test.
range2 – The second data sample or range of cells the function examines for the t-test.
tails – Indicates the number of distribution tails.
- When set to 1: a one-tailed distribution.
- When set to 2: a two-tailed distribution.
type – Indicates the type of T-TEST.
- A paired or dependent test is performed when type is set to 1.
- A two-sample equal variance test is performed when it’s set to 2.
- A two-sample unequal variance test is performed when it’s set to 3.
//This returns the T Score of a paired T.Test for the data in the ranges B4:B14 and C4:C14.
Link to copy the spreadsheet template with the examples
- What are T.TESTS?
- Why perform T.TESTS?
- How to use the T.TEST function in Google Sheets
- Example 1: Performing a paired T.TEST
- Example 2: Two sample equal variance test
- Example 3: Two sample unequal variance test
What are T.TESTS?
T.TESTS are used in comparing the mean of two different samples to know if there is a statistical difference between them. The T.TEST function in Google Sheets finds the probability value of a T.TEST.
T.TESTS are performed to determine if two samples come from the same population. To carry out this test, one uses a method known as hypothesis testing, where you assume that the means of the 2 samples are equal, this is known as the null hypothesis. We also make an alternate hypothesis — that the means of the given samples are not equal. Then, using the T.TEST function in Google Sheets we can test these hypotheses. There are three important factors considered for each sample:
- Difference between the two means
- Standard deviations of the two samples
- Number of data values
Why perform T.TESTS?
Statisticians can use T.TESTS to check if two data sets are equal or closely related for several reasons, in medical research, for instance, experiments can be carried out on two samples e.g a placebo group and a second group. By using T.TEST they can determine if the results from the two groups are the same.
How to use the T.TEST function in Google Sheets
The T.TEST function in Google Sheets enables us to conduct all kinds of T.TESTs right in our worksheets.
Now, let us look at how to use the T.TEST function in Google Sheets to perform all three types of T.TESTS.
Example 1: Using the T.TEST function in Google Sheets to perform a paired T.TEST
To perform a paired sample T.TEST let us follow the steps below.
Step 1: Provide the data sample
We will use the data set below that represents the test scores of 11 pupils in a class before and after a seminar. We will use column B for the before values and column C for the after values.
We are essentially using the before data as a control group here. Our interest is to find out if the seminar truly impacted each student’s performance.
To find out if the two samples have the same mean value, we make the following assumptions:
- Null hypothesis: the two samples have no statistical difference in mean.
- Alternate hypothesis: the two samples have a significant difference in mean.
Note: we will use a significance level of 0.05 to compare the results from our T.TEST.
Now, let us test the hypotheses above.
Step 2: Enter the T.TEST function in Google Sheets
Do the following:
- In an empty cell, preferably the same as used in this tutorial, E4, and enter the T.TEST function, =T.TEST
- Select the T.TEST function from the auto-suggested options.
Step 3: Enter the parameters for the T.TEST function in Google Sheets
Now, we need to provide the parameters needed to perform a paired T-TEST, and do the following:
- Set range 1 to B4:B14
- Set range 2 to C4:C14
- Set the tails to 2
- Finally, set type to 1 indicating we want to perform a paired T.TEST
The full formula will be as shown below.
- Press Enter.
From the result above 0.1293526467, we can infer that our null hypothesis is false, since the p.value > 0.05.
Example 2: Using the T.TEST function in Google Sheets to perform a two-sample equal variance test
To perform a two-sample equal variance test we will use the data below.
This represents the IQ scores of randomly selected individuals from two different regions of the world. Both samples are made up of the same amount of entries.
To test if their means are equal we do the following:
- Set range to A4:A14
- Set range 2 to B4:B14
- Set the tails to 1
- Finally, set type to 2 indicating we want to perform a 2 sample equal variance T.TEST
- Press Enter.
The p-value > 0.05, and the two samples have significantly different means.
Example 3: Using the T.TEST function in Google Sheets to perform a two-sample unequal variance test
We have slightly modified our data set by making a sample longer than the other. This ensures that the variance of the data for Group 1 is not equal to that of Group 2.
Now we are going to test this using similar steps:
- Set range 1 to A4:A14
- Set range 2 to B4:B17
- Set the tails to 2
- Set the type to 3 to perform a 2-sample unequal variance T.TEST
- Press Enter
We can conclude that since our p-value > 0.05, the two samples have significantly different means.
The T.TEST function in Google Sheets determines the relationship between two datasets by testing the difference between their means.
Some related questions
What are the types of T.TESTS?
To understand how to perform T.TESTS in Google Sheets we need to know the various kinds, broadly speaking, there are 2 different types of T.TEST:
- A paired T.TEST is used for testing samples from a single population e.g before and after the treatment of a particular group. In such a case, the before state is used as a control state for the after state. This is also known as a dependent T.TEST.
- Two sample T.TEST is used when two samples come from two different populations. This kind of test is further divided into two: equal variance and unequal variance two-sample T.TESTS. in the former, the data sets are equal in length, while they are unequal in the latter. This is known as the independent T.TEST.
How do you find the p-value from T.TEST in Google Sheets?
The p-value is the value you obtain using the T.TEST function in Google Sheets. To find the p-value simply supply the parameters required by the function. E.g the T.TEST function below:
- B4:B14 is range 1
- C4:C14 is range 2
- The tail is 2
- The type is 1
We then compare this p-value/T-score to a significance level of 0.05 to decide the relationship between both means.
Don’t miss other similar interesting articles on our blog: