BINF702 SPRING 2015 Chapter 7 Hypothesis Testing: One-Sample Inference BINF702 SPRING 2014 Chapter 7 Hypothesis Testing 1
Section 7.9 One-Sample c 2 Test for the Variance of a Normal Distribution Eq. 7.40 (One-Sample c 2 Test for the Variance of a Normal Distribution (Two- Sided Alternative) We compute the test statistic X 2 = (n-1)s 2 /s 2 0 The rejection region is given by X c or X 2 2 2 2 n1, / 2 n1,1 / 2 The acceptance region is given by c X c c 2 2 2 n1, / 2 n1,1 / 2 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 2
Section 7.9 One-Sample c 2 Test for the Variance of a Normal Distribution Eq. 7.41 (p-value for a One- Sample c 2 Test for the Variance of a Normal Distribution (Two-Sided Alternative) Test Statistic X 2 n1 s 2 s 2 0 Case I s s p-value given by 2* Pr( Y X Y ~ c ) 2 2 2 0 n1 Case II s s p-value given by 2* Pr( Y X Y ~ c ) 2 2 2 0 n1 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 3
Section 7.9 One-Sample c 2 Test for the Variance of a Normal Distribution Ex. 7.46 What is s 2 and the p-value? BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 4
7.10 One-Sample Test for a Binomial Distribution Equation 7.42 (One-Sample Test for a Binomial Proportion Normal-Theory Method (Two-Sided Alternative) Let the test statistic be given by z pˆ p p q 0 0 0 / n The rejection region is given by The acceptence region is given by z z or z The test should only be used if np q 5 0 0 / 2 1 / 2 z z z / 2 1 / 2 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 5
7.10 One-Sample Test for a Binomial Distribution Equation 7.43 Computation of the p-value for the One- Sample Binomial Test Normal-Theory Method (Two-Sided Alternative) Let the test statistic be given by z If pˆ p q 0 0 0 p 0 / n pˆ p p-value=2 z If pˆ p 0 p-value 2 1 z BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 6
Approximate Binomial Testing in R prop.test(x, n, p = NULL, alternative = c("two.sided", "less","greater"), conf.level = 0.95, correct = TRUE) Problem 7.10 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 7
7.10 One-Sample Test for a Binomial Distribution Eq. 7.44 (Computation of the p-value for the One- Sample Binomial Test-Exact Method(Two-Sided Alternative) x n k nk If pˆ p0, p 2P X x min 2 p0 1 p0,1 k 0 k n n k nk If pˆ p0, p 2P X x min 2 p0 1 p0,1 kxk BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 8
7.10 One-Sample Test for a Binomial Distribution (Exact Method) binom.test(x, n, p = 0.5, alternative = c("two.sided", "less", "greater"), conf.level = 0.95) Ex. 7.49 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 9
7.10 One-Sample Test for a Binomial Distribution (Exact Method) We note that this is different from the value in the text or the value using the equation in the text. How do you compute this using R? BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 10
7.10 One-Sample Test for a Binomial Distribution Eq. 7.45 (Power for the One-Sample Binomial Test (Two-Sided Alternative)) The power of the one-sample binomial test for the hypothesis H 0 : p = p 0 vs. H 1 : p!=p 0 for the specific alternative p = p 1 is given by pq pq z p p n where np q 5 0 0 0 1 / 2 0 0 1 1 pq 0 0 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 11
7.10 One-Sample Test for a Binomial Distribution Equation 7.46 (Sample-Size Estimation for the One-Sample Test (Two-Sided Alternative)) Suppose we wish to test H 0 : p = p 0 versus H 1 : p!= p 0. The sample size needed to conduct a two-sided test with significance level and power 1 b versus the specified alternative hypothesis p = p 1 is n p q z z p p 0 0 1 / 2 1b 1 0 2 pq pq 1 1 0 0 2 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 12
7.10 One-Sample Test for a Binomial Distribution Can you write a function to implement Equation 7.46? BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 13
7.10 One-Sample Test for a Binomial Distribution Our function in action on Ex. 7.51 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 14
Section 7.11 One-Sample Inference for the Poisson Distribution Eq. 7.47 (One Sample Inference for the Poisson Distribution (Small-Sample Test Critical Value Method) Let X be a Poisson random variable with expected value = m. To test the hypothesis H 0 : m = m 0 versus H 1 : m!= m 0 using a two-sided test with significance level, 1. Obtain the two-sided 100% x (1-) confidence interval for m based on the observed value x of X. Denote the confidence interval (c 1, c 2 ) 2. If m 0 < c 1 or m 0 > c 2, then reject H 0, if c 1 <= m 0 <= c 2, then accept H 0. BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 15
Section 7.11 One-Sample Inference for the Poisson Distribution Eq. 7.48 (One-Sample Inference for the Poisson Distribution (Small-Sample Test p-value Method) Let m = expected value of a Poisson distribution. To test the hypothesis H 0 : m = m 0 versus H 1 : m!= m 0, 1. Compute x = observed number of deaths in the study population 2. Under H 0, the random variable X will follow a Poisson distribution with parameter m 0. Thus the two-sided p-value is given by min 2 x k 0 e min 21 0 k m0 k! m x k 0 e,1 if x 0 k m0 k! m m 0,1 if x m 0 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 16
Section 7.11 One-Sample Inference for the Poisson Distribution Ex. 7.54 Can you solve this using R as a calculator? BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 17
Section 7.11 One-Sample Inference for the Poisson Distribution Def. 7.16 The standardized mortality ratio (SMR) is define by 100% x O/E = 100% x the observed number of deaths in the study population divided by the expected number of deaths in the study population under the assumption that the mortality rates for the study population are the same as those for the general population. For nonfatal conditions the standardized mortality ratio is sometimes known as the standardized morbidity ratio. BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 18
Section 7.11 One-Sample Inference for the Poisson Distribution Eq. 7.49 (One-Sample Inference for the Poisson Distribution (Large-Sample Test) Let m = expected value of a Poisson random variable. To test the hypothesis H 0 : m = m 0 versus H 1 : m!= m 0 (1) Compute x = observed number of events in the study population (2) Compute the test statistic X 2 2 x m SMR 2 0 2 0 1 0 m0 100 (3) For a two-sided test at level, H is rejected if X and m 1 ~ c under H 2 2 c1,1 2 2 H0 is accepted if X c1,1 0 BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 19
Section 7.11 One-Sample Inference for the Poisson Distribution Eq. 7.49 (continued) (4) The exact p-value is given by Pr( c X ) 1 / 2 0 2 2 1 (5) This test should only be used if m 10 (6) In addition, an approximate 100% x (1- ) CI for m is given by x z x BINF702 SPRING 2013 Chapter 7 Hypothesis Testing 20