T tests

Written by

If you haven't read them yet, please take a moment to read my pages on standard deviation and margin of error. They lay out a few concepts you need to understand before thinking about t-tests.

You're back? Good. Now let's start.

Often, you haven't the time or money to measure every single item in a collection of stuff. Sometimes, it's just not practical, either. Let's say you want to see how much force it takes to break new laptop computer. If you break them all, you won't have any left to sell. Not a good idea. Or a particularly smart business plan.

That's why you measure a smaller sample. But the standard deviation of a small sample of data doesn't necessarily tell you anything useful about how wildly the larger group's values vary around their average. And that distribution's important. Because sometimes the average of a small sample comes in where you want it to, but the sample's values are so widely spread around that you can't be sure the larger group's average will come in about the same place as the sample's.

That's where you use the t-test. It's a random variable that uses the standard deviation of the sample to help determine interesting stuff about the larger group it represents.

The t-score factors in a bunch of related values. I'll list them here for reference, but please skip the four lines below if you fear that too much detail will cause you to freak out...

• the average of the values in your sample
• the supposed average of the larger population your sample is drawn from
• the standard deviation of your sample's values
• the number of values in your sample.

The number of values in your sample, minus one, is the "degrees of freedom" of your sample. (One question down, one to go.)

Once you've computed your t-score, you will compare it to a t-value that you look up in a table. You'll select the t-value that corresponds to the same "degrees of freedom" as your sample, and the same margin of error that you're willing to accept.

So if you expect the larger population be normally distributed (C'mon. I'm trusting you read that standard deviation page already), if the t-score you computed is greater the t-value you looked up in the table, you can accept the assumption that the larger population's mean is larger than your guess. If you are hoping that the larger population's mean is less than your assumption, slap a negative sign on the value from the t-table and hope that your (then presumably negative) t-score is less than it.

Okay, let's try this again with an example:

The Burns Co. is now making laptop computers in its Shelbyville plant. Mr. Burns is too cheap to wreck too many computers in a test, so he's letting his quality assurance guru, Homer, smash five of them. Homer is to record from how high in the air he can drop each laptop on the floor before it won't work anymore. Mr. Burns' wants laptops that can survive a fall from his height of five feet, two inches.

You might think Homer could drop the laptops and if the average of the breaking height is over than 5'2", he's cool. But what if the breaking heights were all over the place: let's say four of them broke at various heights under four feet, but one them lasted until a 20-foot drop? (Say, wasn't that the one his daughter built during "Bring Your Kid to Work Day?" Never mind.) That would put the average above 5'2", but was that 20-footer a rare freak, or representative of the (hoped for) high quality of a Burns laptop?

The t-test will tell us if we can accept that the average breaking point for a Burns laptop is greater than 5'2", given what we know about the sample. Let's say the five computers broke at drops of:

• 4 feet, 8 inches
• 5 feet, 1 inch
• 2 feet, 3 inches
• 6 feet, 10 inches
• 7 feet, 1 inch

Using the formula:

```	(avg. of sample) - (presumed avg. of larger pop.)
t =	     ----------------------------------
(st. dev. of sample) / (sq. root of sample size)
```
we get an average breaking height of 62.2 inches (good!) and a t-score of 0.0191 (umm, I don't know yet).

Let's go to the t-score table. There we find the t-value for four degrees of freedom and a 90-percent confidence interval (that's p=.05, since taking .05 off each side of the bell curve leaves us with .90 in the middle). That value is 2.13.

Since our value is less than the table's t-value, that means we cannot accept the assumption that all Burns laptops together have an average breaking drop of over 62 inches. Even though our sample's average came in (just) over that.

Sources: