# T-Tests

## Introduction:

T-tests are a statistical means of understanding the differences between measured means. Let’s say you are trying to see if on average your class is taller than another class. The best way to find out would be to measure the height of every student in each class, find the two means and compare them.

But in the real world, when trying to compare two means, it is not possible or unreasonable to measure every possible sample in each of the sets of interest. For example, consider national polls. Every time one wishes to judge the public pulse on an issue, you would have to ask every citizen, on the scale of an election. To circumvent this, in statistics, there are powerful tools to assist us in understanding if the difference in the means (mean opinion in our example) is different enough that it is not just a fluke during measurement. This is called statistical significance. If the difference is statistically significant, it means that the means are different with such confidence that it wasn’t some random luck. Note that we say confidence because we can only say with very high confidence that the means are different. We cannot guarantee it because we did not ask every citizen of the United States.

## Concept:

When comparing two means, conceptually a bell-curve distribution is imagined around one of the means. The shape of this curve is affected by the number of samples you take. The important concept is that the center of the curve is the first mean. Consider that as the actual mean. When you take measurements, lets say when you flip a coin, you don’t always get 50% heads and 50% tails if you take 10 measurements. Even though the actual mean is 0.5 (50% of 1) for heads, there is a probability distribution around that 0.5 mean for the expected mean for multiple measurements. This distribution says that at the ends, the probabilities are very, very unlikely. For example, if you take 100 measurements of the coin flip, it is extremely unlikely (low probability) that you will get 0% heads or 100% heads. If for some reason you do, it means that the difference is significant enough for you to suspect that something else was affecting the coin flip, like a biased coin.

### Making Sense of the Difference:

While the difference between the means is being stressed for explaining the concept, the actual nature of the difference can also be seen through this test. Whether the mean being compared is greater or lower than the actual (assumed) mean is statistically significant is of more importance in our projects in the website. For figuring this out, first find out the means of the individual lists and compare them to see which one is greater than the other. Now you would need to perform the t-test to see if this specific difference is significant. Follow the protocol listed below for finding the p-value to see if the difference is significant. If the p-value you get here (when you follow this protocol) is less than or equal to 0.05, it means that whatever specific difference (in terms of which mean is greater, not the actual difference in the mean) you observed between the means is statistically significant.

Important Note: Just because your results don’t show statistical significance does not mean there is no statistical significance. Your methods might not have shown the significance. The interpretation of such a case is not binary, whether it is significant or not. If the probability of the mean being compared (p-value) is high, it gives confidence in your conclusion that there is no statistical significance between the two means. On the other hand, if there is statistical significance (p < 0.05), it means that for your methods the means are statistically significant.

## Variance:

Going back to the heights of students in your class example, it would be easier for you to judge the difference by using a t-test. You would randomly select ‘n’ number of students from each of the classes and measure their heights. Now you have two lists of heights, one from each class, for n students each. The more students you sample, the better your results in the sense that you will be able to show significance if there is such a difference.

Refer to “Excel Statistics Formulas” In Guide Section to find the mean of the two lists.

For further clarification and formatting for the purpose of performing a t-test, another method is shown below.

Go to Microsoft Excel like so:

In Microsoft Excel, write your list down like so:

Save your file.

To save your file for the first time, click on “File on the top of the screen to the left corner” and select the option “Save As”

You will see a box up like in the figure above. Press on the Icon “Desktop” to the left. Look at the place where there are capital letters that are highlighted. Type in your name and your project’s name there. Don’t use any special characters like $, %,’, etc. in the name. Then press “Save” on the right.

It is a good idea to constantly save your file during the process so that you wont lose your work if your computer crashes.

For saving your file after you already saved it once, just press on the floppy icon on the top left corner in Excel.

Find the means of the two lists and make note of which mean is greater or lesser than the other.

- To find the mean of a list:
- Left click once on cell where you want to have the mean displayed.
- Double Click the left-click on your mouse.
- Type in ‘=average(’
- Left click once on the first cell in the list you want to find the mean of and don’t let go of the click.
- You screen should look similar to:

The yellow box beneath your cell shows the syntax (what you need to put to in to find the average). You can ignore it if you want.

Drag the mouse down without letting go of the click until you reach the last cell on your list with a value.

Then Press Enter. The mean for that list should be displayed.

Repeat the procedure to find the mean for “Other Class”

You will see:

Look and compare the means. Notice that the two means are close to each other with the mean height of your class greater than the other class, like your prediction.

To see if this difference is significant and not just a fluke because of your selection of people to include in your list despite your efforts for randomly selecting them, a t-test is needed.

To do the t-test:

- Write down t-test, p-value in a neighboring cell like shown in the next figure.
- In the next cell, double click the left click.
- Type in ‘=ttest(’.
- Just like you selected your list for finding the mean, click on the first value of the fist list and drag the mouse down until you reach the last value on that list without letting go of the click. Make sure you don’t select the mean value.
- Type in a comma, and in the same way select the second list.
- Type in ‘,1,3’.

Your field should look similar to:

Double check if you have entered everything correctly and if the right values in the lists are selected as shown by the colored boxes.

Then Press Enter and your p-value will be displayed like so:

Note the p-value.

If it is equal to or less than 0.05, the difference in the means that the average height of students in your class is greater than that of the other class is statistically significant.

In this case it is about 0.1. This means that the difference is not statistically significant. But your claim does have some confidence because the p-value is still relatively low. The confidence decreases with an increase in p-value. This does not mean that on average your class is not taller than the other class. It just means that for the given lists that you used, the difference was not big enough to be statistically significant. This could change if you used more students in the lists.

If you have any questions, don’t hesitate to ask your science or math teacher. You can also email us at sciencefair@math.iit.edu