Download Stat312 Midterm II Solutions: Hypothesis Testing and more Exams Mathematical Statistics in PDF only on Docsity! Stat312: Sample Midterm II. Moo K. Chung mchung@stat.wisc.edu March 25, 2003 1. Consider the sample of fat content of 10 randomly selected hot dogs: 25, 21, 22, 17, 29, 25, 16, 20, 19, 22. Suppose that these are from a normal pop- ulation. We want to test if the fat content of hot dogs is 23. (a) State the null and alternate hypotheses (5 points). (b) What is your test statistic and a rejection rule at 95% level? (5 points) (c) Is the fat content of hot dogs 23? Explain your result (5 points). (d) Compute the probability of type I error when you do the hypothesis test using the test statistic in (b). Explain your result (5 points). (e) Define the P -value and compute the P -value for using the test statistic in (b) (5 points). >X<-c(25,21,22,17,29,25,16,20,19,22) >sum(X) [1] 216 > var(X) [1] 15.6 > qnorm(c(0.025,0.05)) [1] -1.96 -1.64 > qt(0.025,c(9,10)) [1] -2.26 -2.23 > pt(c(1.0,1.1,1.2,1.3,1.4,1.5),9) [1] 0.83 0.85 0.87 0.89 0.90 0.92 Solution. (a) Let µ be the population mean of the fat content in hot dogs. Then H0 : µ = 23 and H1 : µ 6= 23. (b) Since the population variance is unknown, the test statistic should be the t statis- tic given by T = (X̄ − µ)/(S/ √ 10). Note that t0.025,9 = 2.26. So we reject H0 if |T | > 2.26. (c) s2 = 15.6. The t-value is t = (x̄−23)/(s/ √ 10) = −1.12. Since the value is not in the rejection re- gion, we do not reject H0. So we may assume that the fat content of hot dogs is 23. (d) By defini- tion α = P ( reject H0|H0 is true ) = P (|T | > t0.025,9 = 0.05. You should answer this ques- tion without computing anything. (e) The P -value is the smallest level of significance at which H0 would be rejected. For given t-value t = 1.12, we reject H0 if |t| > tα/2,9 at α level. So P -value = P (|T | > 1.12) = 2P (T > 1.12) = 2(1 − P (T ≤ 1.12)) = 2(1 − 0.85) = 0.3 2. 4 out of 10 doctors knew the generic name for the drug methadone. We want to test if fewer than half of all doctors know the generic name for methadone. (a) State the null and alternate hypotheses. Define population parameters clearly (5 points). (b) What is your test statistic? Explain your result (10 points). (c) What is the distribution of the test statistic in (b) under the null hypothesis? Explain your result(5 points). (d) Perform the hypothesis test using a significance level of 0.2 (10 points). > pbinom(0:10,10,0.5) [1] 0.00 0.01 0.055 0.17 0.38 [6] 0.62 0.83 0.95 0.99 1.00 [11] 1.00 Solution (a) Let p be the proportion of doctors who knew the generic name. Then H0 : p = 0.5 vs. H1 : p < 0.5. (b) Since the sample size is too small, you can not use Z statistic. Let Xi be a Bernoulli random variable defined as Xi = 0 if the i-th doctor know and Xi = 0 if the i-th doc- tor does not know the generic name. Note that P (Xi = 1) = p, P (Xi = 0) = 1 − p. The point estimator for p would be p̂ = ∑ 10 i=1 Xi/10 = X̄ . We will take ∑ 10 i=1 Xi rather than X̄ as the test