140 likes | 151 Views
Learn how to conduct hypothesis testing and calculate p-values in the context of a dietary folate study. Understand the concepts of confidence intervals, significance levels, rejection regions, and the interpretation of test statistics.
E N D
Hypothesis testing and p-values (Chapter 9) We used confidence intervals in two ways: • To determine an interval of plausible values for the quantity that we estimate. Level of plausibility is determined by 1-a. 90% (a=0.1) is less conservative than 95% (a=0.05) is less conservative than 99% (a=0.01)... • To see if a certain value is plausible in light of the data: If that value was not in the interval, it is not plausible (at certain level of confidence). Zero is a common certain value to test, but not the only one. Hypothesis tests address the second use directly
Example: Dietary Folate • Data from the Framingham Heart Study n = 333 Elderly Men Mean = x = 336.4 Std Dev = s = 193.4 Can we conclude that the mean is greater than 300 at 5% significance? (same as 95% confidence)
Five Components of the Hypothesis test: 1. Null Hypothesis = “What we want to disprove” = “H0” = “H not” = Mean dietary folate in the population represented by these data is <= 300. = m <= 300 2. Alternative Hypothesis = “What we want to prove” = “HA” = Mean dietary folate in the population represented by these data is > 300. = m > 300
3. Test Statistic To test about a mean with a large sample test, the statistic is z = (x – m)/(s/sqrt(n)) (i.e. How many standard deviations (of X) away from the hypothesized mean is the observed x?) 4. Significance Level of Test, Rejection Region, and P-value 5. Conclusion Reject H0 and conclude HA if test stat is in rejection region. Otherwise, “fail to reject” (not same as concluding H0 – can only cite a “lack of evidence” (think “innocent until proven guilty”) (Equivalently, reject H0 if p-value is less than a.) Next page
Significance Level: a=1% or 5% or 10%... (smaller is more conservative) (Significance = 1-Confidence) • Rejection Region: • Reject if test statistic in rejection region. • Rejection region is set by: • Assume H0 is true “at the boundary”. • Rejection region is set so that the probability of seeing the observed test statistic or something further from the null hypothesis is less than or equal to a • P-value • Assume H0 is true “at the boundary”. • P-value is the probability of seeing the observed test statistic or something further from the null hypothesis. • = “observed level of significance” Note that you reject if the p-value is less than a.(Small p-values mean “more observed significance”)
Example: • H0: m<=300, HA: m>300 • z (x-m)/(s/sqrt(n)) = (336.4 – 300)/(193.4/sqrt(333)) = 3.43 • Significance level = 0.05 • When H0 is true, Z~N(0,1). As a result, the cutoff is z0.05=1.645. (Pr(Z>1.645) = 0.05.) • P-value = Pr(Z>3.43 when true mean is 300) = 0.0003 • Reject. Mean is greater than 300. • Would you reject at significance level 0.0001?
Picture Distribution of Z = (X – 300)/(193.4/sqrt(333))when true mean is 300. Test statistic 0.4 0.3 Rejection region 0.2 Density Observed Test Statistic 0.1 0.0 -4 -2 0 2 4 3.43 1.645 Area to right of 3.43=0.0003 = p-value Test Statisistic Area to right of 1.645=0.05 = sig level
One Sided versus Two Sided Tests • Previous test was “one sided” since we’d only reject if the test statistic is far enough to “one side” (ie. If z > z0.05) • Two sided tests are more common (my opinion): H0: m=0, HA: m does not equal 0
Two Sided Tests (cntd) Test Statistic (large sample test of mean) z = (x – m)/(s/sqrt(n)) Rejection Region: reject H0 at signficance level a if |z|>za/2i.e. if z>za/2 or z<-za/2 Note that this “doubles” p-values. See next example.
Example: • H0: m=300, HA: m doesn’t equal 300 • z=(x-m)/(s/sqrt(n)) = (336.4 – 300)/(193.4/sqrt(333)) = 3.43 • Significance level = 0.05 • When H0 is true, Z~N(0,1). As a result, the cutoff is z0.025=1.96. (Pr(|Z|>1.96)=2*Pr(Z>1.96)=0.05 • P-value = Pr(|Z|>3.43 when true mean is 300) = Pr(Z>3.43) + Pr(Z<-3.43) = 2(0.0003)=0.0006 • Reject. Mean is not equal to 300. • Would you reject at significance level 0.0005?
Picture Distribution of Z = (X – 300)/(193.4/sqrt(333))when true mean is 300. Test statistic 0.4 Sig level = area to right of 1.96 + area to the left of -1.96 = 0.05=a 0.3 Rejection region Rejection region 0.2 Density 0.1 0.0 -4 -2 0 2 4 -3.43 3.43 1.96 1.96 Test Statisistic Area to right of 3.43=0.0003 Area to left of -3.43=0.0003 Pvalue=0.0006=Pr(|Z|>3.43)
Power and Type 1 and Type 2 Errors Action Fail to Reject H0 Reject H0 Significance level = a =Pr( Making type 1 error ) correct H0 True Type 1 error Truth Power = 1–Pr( Making type 2 error ) Type 2 error correct HA True
Assuming H0 is true, what’s the probability of making a type I error? • H0 is true means true mean is m0. • This means that the test statistic has a N(0,1) distribution. • Type I error means reject which means |test statistic| is greater than za/2. • This has probability a.