Lecture Notes 9 Econ 29000, Principles of Statistics Kevin R Foster, CCNY Fall 2011 |
|
Details of Distributions T-distributions, chi-squared, etc. |
|
Take the basic methodology of Hypothesis Testing and figure out how to deal with a few complications.
T-tests
The first complication is if we have a small sample and we're estimating the standard deviation. In every previous example, we used a large sample. For a small sample, the estimation of the standard error introduces some additional noise – we're forming a hypothesis test based on an estimation of the mean, using an estimation of the standard error.
How "big" should a "big" sample be? Evidently if we can easily get more data then we should use it, but there are many cases where we need to make a decision based on limited information – there just might not be that many observations. Generally after about 30 observations is enough to justify the normal distribution. With fewer observations we use a t-distribution.
To work with t-distributions we need the concept of "Degrees of Freedom" (df). This just takes account of the fact that, to estimate the sample standard deviation, we need to first estimate the sample average, since the standard deviation uses . So we don't have as many "free" observations. You might remember from algebra that to solve for 2 variables you need at least two equations, three equations for three variables, etc. If we have 5 observations then we can only estimate at most five unknown variables such as the mean and standard deviation. And "degrees of freedom" counts these down.
If we have thousands of observations then we don't really need to worry. But when we have small samples and we're estimating a relatively large number of parameters, we count degrees of freedom.
The family of t-distributions with mean of zero looks basically like a Standard Normal distribution with a familiar bell shape, but with slightly fatter tails. There is a family of t-distributions with exact shape depending on the degrees of freedom; lower degrees of freedom correspond with fatter tails (more variation; more probability of seeing larger differences from zero).
This chart compares the Standard Normal PDF with the t-distributions with different degrees of freedom.
This table shows the different critical values to use in place of our good old friend 1.96:
Critical Values for t vs N |
|
|||||
df |
95% |
90% |
99% |
|||
5 |
2.57 |
|
2.02 |
|
4.03 |
|
10 |
2.23 |
1.81 |
3.17 |
|||
20 |
2.09 |
1.72 |
2.85 |
|||
30 |
2.04 |
1.70 |
2.75 |
|||
50 |
2.01 |
1.68 |
2.68 |
|||
100 |
1.98 |
1.66 |
2.63 |
|||
Normal |
1.96 |
|
1.64 |
|
2.58 |
|
The higher numbers for lower degrees of freedom mean that the confidence interval must be wider – which should make intuitive sense. With just 5 or 10 observations a 95% confidence interval should be wider than with 1000 or 10,000 observations (even beyond the familiar sqrt(N) term in the standard error of the average).
T-tests with two samples
When we're comparing two sample averages we can make either of two assumptions: either the standard deviations are the same (even though we don't know them) or they could be different. Of course it is more conservative to assume that they're different (i.e. don't assume that they're the same) – this makes the test less likely to reject the null.
Assuming that the standard errors are different, we compare this test statistic against a t-distribution with degrees of freedom of the minimum of either or .
Sometimes we have paired data, which can give us more powerful tests.
We can test if the variances are in fact equal, but a series of hypothesis tests can give us questionable results.
Note on the t-distribution:
Talk about the t distribution always makes me thirsty. Why? It was originally called "Student's t distribution" because the author wanted to remain anonymous and referred to himself as just a student of statistics. William Gosset worked at Guinness Brewing, which had a policy against its employees publishing material based on their work – they didn't want their brewing secrets revealed! It's amusing to think that Gosset, who graduated top of his class from the one of the world's top universities in 1899, went to work at Guinness –at the time that was a leading industrial company doing cutting-edge research. A half-century later, the brightest students from top universities would go to GM; after a century the preferred destinations would be Google or Goldman Sachs. The only thing those companies have in common is the initial G.
Other Distributions
There are other sampling distributions than the Normal Distribution and T-Distribution. There are χ2 (Chi-Squared) Distributions (also characterized by the number of degrees of freedom); there are F-Distributions with two different degrees of freedom. For now we won't worry about these but just note that the basic procedure is the same: calculate a test statistic and compare it to a known distribution to figure out how likely it was, to see the actual value.
(On Car Talk they joked, "I once had to learn the entire Greek alphabet for a college class. I was taking a course in ... Statistics!")
Examples of hypothesis testing with t-distributions
1. For a t Distribution with sample average of 1.98, standard deviation of 1.37, and 8 observations, what is the area in both tails, for a null hypothesis of zero mean?
Answer: The standard error of the average is 1.37/sqrt(8) = 0.484. The test statistic against the null hypothesis of zero mean divides the average by its standard error, so 1.98/0.484 = 4.09. Then use Excel (or other program or look up in a table) to find that TDIST(4.09, 7, 2) [a t-distribution with 7 degrees of freedom {=8 – 1} and 2 tails] = 0.0046.
2. For a t Distribution with sample average of 2.76, standard deviation of 1.16, and 28 observations, what is the area in both tails, for a null hypothesis of zero mean ?
3. For a t Distribution with sample average of 0.85, standard deviation of 0.37, and 5 observations, what is the area in both tails, for a null hypothesis of zero mean ?
4. For a t Distribution with 22 observations and standard deviation of 2.12, what sample mean leaves 0.10 in the two tails?
5. For a t Distribution with 9 observations and standard deviation of 1.19, what sample mean leaves 0.05 in the two tails?
6. For a t Distribution with 30 observations and standard deviation of 2.95, what sample mean leaves 0.01 in the two tails?
7. Sample A has mean 1.92, standard deviation of 2.24, and 26 observations. Sample B has mean 3.57, standard deviation of 1, and 29 observations. Test the null hypothesis of no difference.
8. Sample A has mean 2.16, standard deviation of 1.06, and 17 observations. Sample B has mean 2.69, standard deviation of 0.02, and 16 observations. Test the null hypothesis of no difference.
9. Sample A has mean 2.96, standard deviation of 0.89, and 18 observations. Sample B has mean 0.11, standard deviation of 2.89, and 12 observations. Test the null hypothesis of no difference.
Extra to work on:
10. For a t Distribution with sample average of 4.41, standard deviation of 0.35, and 7 observations, what is the area in both tails, for a null hypothesis of zero mean ?
11. For a t Distribution with sample average of 1.16, standard deviation of 2.7, and 7 observations, what is the area in both tails, for a null hypothesis of zero mean ?
12. For a t Distribution with sample average of 0.03, standard deviation of 2.35, and 5 observations, what is the area in both tails, for a null hypothesis of zero mean ?
13. For a t Distribution with 24 observations and standard deviation of 1.25, what sample mean leaves 0.56 in the two tails?
14. For a t Distribution with 11 observations and standard deviation of 0.05, what sample mean leaves 0.48 in the two tails?
15. For a t Distribution with 4 observations and standard deviation of 0.48, what sample mean leaves 0.92 in the two tails?
16. For a t Distribution with 8 observations and standard deviation of 1.05, what sample mean leaves 0.69 in the two tails?
17. Sample A has mean 4.9, standard deviation of 2.19, and 27 observations. Sample B has mean 4.48, standard deviation of 0.84, and 5 observations. Test the null hypothesis of no difference.
18. Sample A has mean 3.24, standard deviation of 0.2, and 9 observations. Sample B has mean 0.49, standard deviation of 1.96, and 22 observations. Test the null hypothesis of no difference.
19. Sample A has mean 0.01, standard deviation of 0.01, and 15 observations. Sample B has mean 4.04, standard deviation of 2.6, and 2 observations. Test the null hypothesis of no difference.
20. Sample A has mean 0.34, standard deviation of 2.14, and 27 observations. Sample B has mean 4.94, standard deviation of 1.1, and 18 observations. Test the null hypothesis of no difference.
21. Sample A has mean 0.54, standard deviation of 0.71, and 20 observations. Sample B has mean 3.09, standard deviation of 0.14, and 27 observations. Test the null hypothesis of no difference.
22. Sample A has mean 2.31, standard deviation of 2.98, and 23 observations. Sample B has mean 0.85, standard deviation of 2.65, and 12 observations. Test the null hypothesis of no difference.
23. Sample A has mean 3.95, standard deviation of 2.33, and 30 observations. Sample B has mean 4.59, standard deviation of 0.14, and 2 observations. Test the null hypothesis of no difference.
24. Sample A has mean 3.99, standard deviation of 1.59, and 26 observations. Sample B has mean 0.1, standard deviation of 1.93, and 4 observations. Test the null hypothesis of no difference.
25. Sample A has mean 3.95, standard deviation of 2.56, and 22 observations. Sample B has mean 2.23, standard deviation of 0.82, and 18 observations. Test the null hypothesis of no difference.
You have doubtless noticed by now that much of the basic statistical reasoning comes down to simply putting the numbers into a basic form, , where the X-bar is the sample average, the Greek letter mu, µ, is the value from the null hypothesis, and the Greek letter sigma, σ, is the standard error of the measurement X-bar. This basic equation was used to transform a variable with a Normal distribution into a variable with a Standard Normal distribution (µ=0 and σ=1) by subtracting the mean and dividing by the standard deviation.
It might not be immediately clear that even when we form hypothesis tests on the differences between two samples A and B, so we compare with , that we're using that same form. But it should be clearer if we notate the difference as D, where , so the test statistic general form is , where we usually test the null hypothesis of µ=0 so it drops out of the equation. The test statistic, , then, is really the usual form, but without writing the zero. Then we use the formula already derived to get the standard error of the difference in means, σD
The only wrinkle introduced by the t-distribution is that we take the exact same form, , but if there are fewer than 30 observations we look up the value in a different table (for a t distribution); if there are more than 30 or so, we look up the value in the normal table just like always.
Going forward, when we use a different estimator (something more sophisticated than the sample average) we will create other test statistics (sometimes called t-statistics) of the same basic form, but for different estimators – call it . Then the test-statistic is , where we use the standard error of this other estimator. So it's not a bad idea, in a beginning course in statistics, to reflexively write down that basic formula and start trying to fill in values. Ask what is the estimator's value in this sample? That's . What is the value of that statistic, if the null hypothesis were true? That's µ. What's the standard error of the estimator? That's . Put those values into the formula and roll!
Statisticians, who know the whole Greek alphabet, sometimes say as "X-wiggle" or "X-twiddle" as if they don't know what a tilde is.