Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Statistics 60: Fall 2011 Section 7 (Nov 11) TA: Dennis Sun Statistics 60: Section 7 1 Review from Last Week Expected Value Standard Error Distribution Sum of n draws n × avg(box) √ n × SD(box) approx. normal Mean of n draws avg(box) SD(box) √ n approx. normal Confidence Intervals for a Proportion • p is the (unknown) proportion of 1 ’s in a 0-1 box. • p̂ is the observed proportion of 1 ’s in our sample. √ √ p(1−p) p̂(1−p̂) d √ , can approximate by bootstrap estimate: SE(p̂) = √n . • SE(p̂) = n √ p̂(1−p̂) • p̂ ± 2 · √n is an interval that contains p 95% of the time. (This is a confidence interval.) 2 Confidence Intervals for a Mean Suppose that instead the proportion p who support Rick Perry, we now want to know the average human body temperature. In a 1992 study published in the Journal of the American Medical Association, scientists found the average body temperature of 130 adults to be 98.25◦ F with an SD of 0.73◦ F. Can we create a 95% CI for the average body temperature based on this information? The box model in this case consists of tickets with the body temperature of every human: 97.9◦ 98.5◦ · · · 98.1◦ The data for the 130 adults represent 130 draws from this box. So 98.25◦ is the mean of 130 draws from this box, and we want to estimate the mean of the entire box. Math-to-English Translation: µ = average of numbers in the box/population (i.e. what we want to know). X = average of numbers in our sample (i.e. what we actually observe). We know that the mean of 130 draws (call it X) follows the normal curve with EV = µ, so: 95% of X’s will fall within 2 SE’s of µ. Just as last week, we can rephrase this statement as: µ falls within 2 SE’s of 95% of X’s. Thus, if we consider the intervals X ± 2 · SE for each X, then µ falls in 95% of these intervals: 95% of intervals X ± 2 · SE contain µ. We call an interval X ± 2 · SE a 95% confidence interval for µ. 1 stats60.com Statistics 60: Fall 2011 Section 7 (Nov 11) TA: Dennis Sun √ Since X is the mean of n draws from a box, we know that SE(X) = SD(box) . But we usually don’t n know SD(box). So we typically replace SD(box) by SD(sample). This is the bootstrap estimate. The Connection with Proportions The reasoning above is almost exactly the same as the one from last week for proportions. This is because a proportion is nothing more than the mean of a bunch of 0 ’s and 1 ’s. Example 1 (Human Body Temperature). Find a 95% CI for the average human body temperature based on the data above. So, what is a confidence interval anyway? Last week, we talked so much about all the ways you can’t interpret a confidence interval that it might seem that the numbers in a particular interval have no meaning at all! Well, not quite. The confidence interval does at least tell us where the mean of the box is “likely” to be. • With a 90% confidence interval, we can be pretty sure that the interval we observed is one of the 90% that contained the true mean, rather than the other 10%. • With a 95% confidence interval, we can be really sure that the interval we observed is one of the 95% and not one of the 5%. • And with a 99% confidence interval, we can be really really...well, you get the idea. Note that the 95% interval in Example 1 does not contain 98.6◦ . What does this mean? 3 Hypothesis Testing Everyone knows that the average human body temperature is 98.6◦ F, right? The 95% confidence interval above suggests otherwise. In fact, a 99% confidence interval would not contain 98.6◦ either. Just how strong is the evidence against 98.6◦ ? We can test the hypothesis that the average body temperature is 98.6◦ and that the observed deviation is due to chance. For example, if we had observed that the average of the 130 samples was 98.59◦ , we would probably chalk it up to random chance error. But just how close is 98.25◦ to 98.6◦ ? At some point, the deviation becomes too large for “chance error” to be an adequate explanation. 2 stats60.com Statistics 60: Fall 2011 Section 7 (Nov 11) TA: Dennis Sun We can think of the problem as deciding between two hypotheses. On the one hand, we have the null hypothesis, which says that the observed deviation is due to chance: H0 : The average human body temperature is 98.6◦ . (µ = 98.6◦ ) On the other, we have the alternative hypothesis, which says that the observed deviation from 98.6◦ is too large to be due to chance, so the average is likely something other than 98.6◦ : HA : The average human body temperature is not 98.6◦ . (µ 6= 98.6◦ ) To decide between the two hypotheses, we determine the probability of obtaining a sample of 130 people with an average as far away as 98.25◦ if the null hypothesis were true (i.e. if the average of the population were actually 98.6◦ ). If this probability is small (say, < 5%), we reject the null hypothesis and conclude that the average is not 98.6◦ . Example 2 (Human Body Temperature, Take Two). Test the hypotheses above by calculating the probability that the average of a sample of 130 people is as far away as 98.25◦ if the null hypothesis really were true. This probability is called the p-value. Four Easy Steps to a Hypothesis Test 1. State the null and alternative hypotheses. 2. Sketch the distribution of the sample statistic (i.e. X, the average of 130 draws from the box in the example above) under the null hypothesis. (Usually it is normally distributed, and you need to determine the mean and SD.) 3. Draw where your observed statistic (i.e. 98.25◦ in the example above) falls along this distribution. Shade in the region that corresponds to deviations at least as extreme as the one you observed. 4. Calculate the probability of the shaded region. This is the p-value. Since sample statistics are normally distributed, you will first need to convert your observed statistics to a z-score: z= obs − exp0 SE0 This is why the test is often called a z-test! 3 stats60.com Statistics 60: Fall 2011 Section 7 (Nov 11) TA: Dennis Sun Why is the p-value the probability of observing something at least as extreme as 98.25◦ , rather than just the probability of observing 98.25◦ ? • First, the probability of observing a sample mean of exactly 98.25◦ is 0 (or close to 0). • The at least as extreme reminds me of something baseball commentators like to say: Matt Kemp’s 2011 season marks just the 53rd time in MLB history that a player has hit 30 home runs and stolen 30 bases in a season. Certainly we don’t mean times a player has hit exactly 30 home runs and stolen exactly 30 bases. We mean 30-30 or better. If a player were to hit 35 home runs and steal 42 bases, that would be even more impressive. We should still include him in the 30-30 club. We can do hypothesis testing for proportions, too. Example 3 (Next Week’s Quiz). In a rare cruel streak, Professor Walther decides to make next week’s quiz 16 true-false questions about obscure Broadway musicals. (a) Suppose Jennifer (a student in the class) answers 13 of the 16 questions correctly for a score of 6.5/8. Are you convinced she knows anything about obscure Broadway musicals? (b) In fact, Jennifer scored the highest in the class. Are you surprised that someone in a class of 250 people would score a 6.5/8? 4 stats60.com