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
Presentation 9 Hypothesis Tests for Proportion 1- Methods of Statistical inference A. Confidence Intervals. From Chapter 10, we have seen that the basic construction involves a point estimate of the parameter of interest plus/minus some error. C.I's allows us to estimate an unknown quantity (e.g. population proportion) with some degree of certainty using an interval. B. Hypothesis testing. Rather than reporting an interval estimate, a researcher might have a preconceived notion or claim regarding a population parameter. This is called the research or alternative hypothesis. (A statement that something is happening.) The status quo, or negation of the alternative hypothesis is called the null hypothesis. (A statement that nothing is happening.) A hypothesis test is setup in hopes of being able to reject the null hypothesis, denoted by H0, and thereby accept the alternative hypothesis, denoted by Ha. In hypothesis testing, we assume that the null hypothesis is the possible truth until using the data we conclude otherwise. The "something is happening" hypothesis is chosen only when the data show us that we can reject the "nothing is happening" hypothesis. Utts and Heckart. Inference Steps 1. Decide what technique to use. Confidence Intervals and Hypothesis Tests: • 1-Proportion • 1-Mean • Difference between 2-Proportions • Difference between 2-Means Hypothesis Tests: • Difference between Paired Means. • Chi-Square (Relationship between 2 Categorical Variables) • Regression (Relationship between 2 Quantitative Variables) • ANOVA (Difference between 3 or More Means) 2. Write the the null and alternative hypotheses (no need if you are interested in a confidence interval). 3. Check the conditions to make sure the technique is valid. 4. Calculate the p-value or CI. 5. Write an appropriate conclusion. When do we Need Inference. Example 1: Some stockholders want to know if the mean salary for male employees in a large company is higher than the mean salary for female employees. The company allows them to access salary information from a random sample of 100 male and 100 female employees. The mean salaries are $41,000 for the males, and $39,500 for the females. Based on these means, can the shareholders determine that the mean salary for males in the company is higher than the mean salary for females? No, you would have to use an inference technique. A test of 2-means would work. Example 2: Suppose a new drug (Compound X) for fever relief is developed. The standard drug Tylenol reduces fever in 70% of patients. Compound X is administered to random 800 patients with fevers and 592 experience relief. Naturally the company that makes compound X wants to show that it is more effective than Tylenol. Based on the sample proportion 592/800=0.74, can the scientists determine that compound X works better than Tylenol? No, you would have to use an inference technique. A test of 1-proportion would work. Steps for a Hypothesis Tests for 1-Proportion Step 1: Write the null and alternative hypotheses. H0 : p = p 0 Ha: p ≠ p0 or p > p0 or p < p0 It’s important to specify the form of the Ha, but not of the H0 (we will see why). So the H0 will always be of the form “equal to”. Hypothesis tests can be 1-sided (Ha: p> p0 or p < p0 ) or 2-sided (Ha: p ≠ p0 ). Ha is the hypothesis the investigator wants to claim as true, or wants evidence for. Step 2: Check the conditions for a valid test. 1. The sample is a random sample from the population of interest. 2. Both np0 and n (1-p0) must be ≥ to 10. Steps for a Hypothesis Tests for 1-Proportion Step 3: Calculate the test statistic and the p-value. The logic in hypothesis testing is to assume that H0 is true until we prove otherwise. The test-statistic is like the z-score of the sample estimate (p̂ ) under the assumption that H0 is true (i.e. p=p0). Sample estimate - Null value z - stat Null Std. Error pˆ p 0 p 0(1 p 0) n Note that if p truly equals p0, and the conditions in Step 3 are p̂ valid, then the sampling distribution of is approximately normal with mean p0 and standard deviation p0(1 p0) n . Next we will see how the p-value is calculated under the assumption that H0 is true! Steps for a Hypothesis Tests for 1-Proportion Step 3: (Continue) What is the p-value? The p-value is the probability of getting a result as extreme (or more extreme) as the observed test statistic in the direction of Ha, assuming H0 is true. In other words, suppose that p truly is p0, what is the chance (probability) that we would have observed p̂ as extreme or more extreme than the one we observed. If this p-value (probability) is very low, then we say our data inconsistent with the null hypothesis and therefore we reject it. Steps for a Hypothesis Tests for 1-Proportion Step 3: (Continue) Calculating the p-value. Ha p-value p < p0 P(Z < z-stat) p > p0 P(Z > z-stat) p ≠ p0 2P(Z > |z-stat|) Note: p-value for a 2-sided alternative is twice the p-value for an 1-sided alternative. Steps for a Hypothesis Tests for 1-Proportion Step 3: (Continue) Illustration of p-values. Suppose z-stat = 2. 2-Sided Hypothesis Ha: p ≠ po 0.3 p-value = P(Z>2) 0.0 0.1 0.1 0.2 Density 0.2 P(Z<-2) and P(Z>2) 0.0 Density 0.3 1-Sided Hypothesis Ha: p > po -4 -2 0 Z 2 4 -4 -2 0 Z 2 4 Step 4: Decide whether the result is statistically significant based on the p-value. Based on the p-value we have two possible conclusions 1. If p-value < α, then reject H0. and claim that Ha is true. 2. If p-value > α, then fail to reject H0 and claim that there isn't enough evidence to report Ha is true. (In this case, we do not claim that the null is true!) α is the significance level (usually α = 0.05). Definition: The results are statistically significant if the p-value is less than α. Rejection region approach - An equivalent way to determine if we reject or not H0 in favor using the z-stat instead of the p-value. e.g. for Ha: p > p0, α = 0.05, then reject H0 if z-stat>1.96. See table one page 330 in the book for more examples. WHY? Small p-value implies that assuming p=p0, the probability of observing the result we have observed is small. The smaller the pvalue is, the stronger the evidence is that p=p0 is not the truth! Also, small p-value implies that z-stat is extreme in the direction of the alternative, thus we reject the H0 in favor of Ha. Step 5: Report the conclusion in the context of the situation. A Detailed Example Suppose a new drug (Compound X) for fever relief is developed. The standard drug Tylenol reduces fever in 70% of patients. Compound X is administered to random 800 patients with fevers and 592 experience relief. Naturally the company that makes compound X wants to show that it is more effective than Tylenol. Conduct an appropriate hypothesis test. Step 1. State the Null and Alternative Hypotheses H0: p = .7 Ha: p > .7 Step 2. Check the conditions for the test to be valid.. 800(.7) = 592 800(1-.7) = 208 are ≥ 10, and we can assume that the sample is representative of the population. So the are conditions met. Example Cont. Step 3. Calculate the test statistic and p-value. pˆ 592 800 p 0(1 p 0) .7(1 .7) Std.Error( pˆ ) .0162 n 800 pˆ p 0 .74 .70 z - statistic 2.47 .0162 p 0(1 p 0) n p - value P (Z 2.47) 1 - P (Z 2.47) 1 - .9932 .0068 Example Cont. Connection of p-value to the Sampling Distribution: Note that the p-value is calculated under the assumption that H0 is true! If p = .7, then the sampling distribution of p̂ is normal with mean p = .7 and standard deviation p(1 p) n = .0162 15 Density 10 5 That is, p-value = P( p̂ > .74) = P(Z>2.47) since 2.47 is the z-score of .74. 0 The p-value equals the probability of getting a p̂ as extreme as .74 if the null were in fact true. 20 Sampling Dist: P-value Shaded 0.65 0.70 p-hat 0.75 Example Cont. Step 4. Decide whether the result is statistically significant based on the p-value. p-value = .0068 which is less than .05 so REJECT the null hypothesis! Step 5. Report the conclusion in the context of the situation. Since the p-value < .05, we have enough evidence to reject the null hypothesis and claim that the alternative is true. We conclude that the new drug Compound X IS MORE EFFECTIVE at relieving fever than the standard drug Tylenol. Two-Types of Errors in Hypothesis Testing When we make our conclusion in a hypothesis test it is possible that we made one of two errors. Type 1 Error: Occurs when the null hypothesis is actually true, but we reject it. Type 2 Error: Occurs when the null hypothesis is actually false, but we fail to reject it. H0 Fail to Reject H0 Reject H0 Truth Correct Decision Type 1 Ha Type 2 Correct Decision Two-Types of Errors in Hypothesis Testing Type 1 and Type 2 errors do NOT occur due to a calculation mistake! They simply occur because we can never be 100% certain in our conclusion. For example: Consider the Tylenol example. We argued that Compound X was better than Tylenol because 74% of patients had relief, and that the probability of getting that result by chance was VERY REMOTE (<1/100). It is POSSIBLE however that we made a Type 1 error. It is possible that Compound X has the same effectiveness as Tylenol and we just had a lucky sample. In statistics we are NEVER 100% certain, we just quantify the evidence, and use it to make an educated decision. C.I’s and Two sided tests Suppose we are testing H0: p = p0 vs. Ha: p ≠ p0 and we have an (1-α)100% CI for the same data. If the value of p0 is not contained in the corresponding interval, then we can reject the null hypothesis at the α significance level. For α=.05, we are 95% confident that p is within an interval and the value p0 is not in there...then we reject this hypothesis (H0: p = p0) and claim the alternative is true. The probability of making Type 1 error is .05. Example: Statistical Significance vs Practical Significance In 1998, 24.2% of female high school students had tried ecstasy. In 2001, a major drug study is undertaken to determine if ecstasy use by teenage females is on the rise. As part of the study 50,000 random female students are asked whether or not they have ever used ecstasy. 12,280 of the females said yes. Has the proportion of female ecstasy users increased from 1998. H0: p = .242 vs Ha: p > .242 . pˆ 12280 .242(1 .242) .2456 .242 .2456, sd( pˆ ) .0019, z stat 1.89 50000 50,000 .0019 p-value = P(Z > 1.89)=1- P(Z < 1.89) = .03038. < .05. Therefore, we reject the null hypothesis, and conclude that ecstasy use is greater than 24.2%. The researches conclude that “Ecstasy Use Among Female High School Students is on the Rise”. This statement is misleading! Statistical significance says it is on the rise, but if you look at the actual proportion, 24.56%, for the 2001 sample, it is not much different than 24.2% from 1998. It might be statistically significant, it does not appear to be practically significant.