AP Statistics Audio Lectures
t tests
by Arnold Kling

Finally, we can treat the realistic case where the mean and standard deviation are unknown, and you take your estimates from your sample.

Suppose that the null hypothesis is that the average weight of NFL linebackers is 235 pounds, and the alternative hypothesis is that the average weight is greater. We take a sample of 16 linebackers and find that the average weight is 242 pounds with a sample standard deviation, s, of 14 pounds. The true standard deviation, s, is unknown. Here is how we conduct the test.

We compute t = (X - m)/[s/sqrt(n)], which looks a lot like a Z variable. In this case, we get t = (242-235)/[14/sqrt(16)] = 2.0

Because the sample mean and the sample standard deviation are not strictly independent of one another (both are computed using the same observations), the distribution of t is not exactly normal (although it approaches normal in large samples). In fact, there are a family of t distributions, one for each level of the degrees of freedom.

Degrees of freedom? For this type of t-test, the degrees of freedom are n-1, where n is the sample size. In this case, df = 15. If our sample had 23 observations, df would be 22.

The table in the back of the book is organized with df down the left-hand side and p-values across the top. The t-ratio is what is in the middle. So, it is a sort of "inside-out" version of the Z table.

We have df = 15 and t = 2.0. In the table, we look at the row for df=15 and look for the closest number to 2.0. There is a value of 1.753 under the column headed by .05, and a value of 2.131 under the column headed by .025. So, we conclude that the p-value is between .025 and .05, and it is closer to .025. So, if our significance level were .05, we would reject the null hypothesis and say that linebackers are heavier than 235 pounds.

Suppose that we took a sample of 25 linebackers, the average weight was 238 pounds, and the sample standard deviation was 10 pounds. Calculate t and find the approximate p-value.

t = (238-235)/[10/sqrt(25)] = 1.5

df = 25 - 1 = 24. For that row, t = 1.318 under p-value = .10, and t = 1.711 under p-value = .05, so the p-value seems to be about half way between .05 and .10

### Confidence Intervals

In the table in the back of the book, the confidence level is at the bottom, and you could use that along with the degrees of freedom to read from the table a t*, so that the margin of error can be calculated as t*s/sqrt(n).

Suppose we want a 90 percent confidence interval for the sample mean in our new sample of 25 observations with a mean of 238 and a standard deviation of 10. From the table, we look at the bottom for 90 percent and then read up to the row with 24 degrees of freedom. This gives us t* = 1.711, which we multiply by 10/sqrt(25) to get 3.422. So the 90 percent confidence interval is 238 plus or minus 3.422.

### Using the Calculator

Chances are, you will never use the table. Your calculator already knows how to calculate p-values exactly. You just go to stats/tests/t-test. You enter m, X, s, n, and whether the alternative is >, <, or a two-sided alternative. The calculator will give you a p-value. If all you had were the data, e.g. 8 football players with weights 251, 227, ...237, you would enter the data in a list and input the list into the t-test.

You can also use the calculator to get a confidence interval. Instead of selecting t-test, you select t-interval, and it allows you to enter all of the data, including the confidence level that you want to use.

### Matched Pairs

Sometimes, data come from a matched-pairs study. An example would be a before-and-after study of a treatment. You weigh subjects before and after they go on a diet. You subtract the weight afterward from the weight before for each subject. So if Alex lost 4 pounds, the value you get would be 4. If Frank gained 2 pounds, the value would be -2. Then you take the average of all of these values. Suppose that the average is 3.5 pounds with a standard deviation of 3 pounds, and that the sample size is 9 men. You enter the data into the t-test, with a null hypothesis that m = 0. The null hypothesis is always 0 for matched pairs.

### Two samples

Suppose that you give the diet to a set of women and to a set of men. You want to see if the average weight loss is the same for each. This is a two-sample test. Suppose that 16 women tried the diet, the average weight loss was 2 pounds, and the standard deviation was 4 pounds. To see whether the difference between the men and women is significant, you select two-sample t-test from the calculator. Do not select "pooled." Calculate the p-value. You should fail to reject the null hypothesis that the weight loss is identical.

The degrees of freedom in a two-sample test is often not an integer. It is a weighted average of the degrees of freedom in the separate samples. The formula is a mess-- it is good to have a calculator. "Pooled" means you have some reason to believe that the standard deviation is identical between the two populations.

Suppose we want to test to see whether linebackers weigh the same today as 20 years ago. We could take a sample from 20 years ago and a sample today. Suppose that today's sample had 25 linebackers with an average weight of 238 pounds and a standard deviation of 10 pounds, and the sample from 20 years ago had 18 linebackers with an average weight of 234 pounds with a standard deviation of 8 pounds. Enter this information into the calculator. You should be able to reject the null hypothesis that they have the same weight.

two-sample t-interval

### Good Habits

1. Determine what type of test: regular one-sample t-test; matched pairs; or two-sample
2. Check that assumptions are reasonable. For really small samples (15 or less), the data have to be reasonably close to normal. For larger samples, skewed data is not so bad.
3. State the null and alternative hypotheses in words. Note whether the alternative is one-sided or two-sided.
4. State the null and alternative hypotheses in symbols.
5. Show the data that you are entering into your calculator. Example: n = 23, X = 238.4, s = 14
6. Report the results, including the degrees of freedom and the p-value
7. State the conclusion in words. Example: "at a 5 percent level of significance, we fail to reject the null hypothesis that today's linebackers on average weigh 235 pounds."