Chapter 14 Tests of Hypotheses Based on Count Data

Slides:



Advertisements
Similar presentations
Hypothesis Testing. To define a statistical Test we 1.Choose a statistic (called the test statistic) 2.Divide the range of possible values for the test.
Advertisements

Chapter 12: Testing hypotheses about single means (z and t) Example: Suppose you have the hypothesis that UW undergrads have higher than the average IQ.
Chapter 12 Tests of Hypotheses Means 12.1 Tests of Hypotheses 12.2 Significance of Tests 12.3 Tests concerning Means 12.4 Tests concerning Means(unknown.
Hypothesis Testing IV Chi Square.
Copyright ©2011 Brooks/Cole, Cengage Learning More about Inference for Categorical Variables Chapter 15 1.
Copyright ©2006 Brooks/Cole, a division of Thomson Learning, Inc. More About Categorical Variables Chapter 15.
Significance Testing Chapter 13 Victor Katch Kinesiology.
© 2010 Pearson Prentice Hall. All rights reserved The Chi-Square Test of Independence.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 25, Slide 1 Chapter 25 Comparing Counts.
Chapter 14 Tests of Hypotheses Based on Count Data
BCOR 1020 Business Statistics
Chapter Goals After completing this chapter, you should be able to:
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 14 Goodness-of-Fit Tests and Categorical Data Analysis.
BCOR 1020 Business Statistics Lecture 21 – April 8, 2008.
BCOR 1020 Business Statistics
Definitions In statistics, a hypothesis is a claim or statement about a property of a population. A hypothesis test is a standard procedure for testing.
Statistical Analysis. Purpose of Statistical Analysis Determines whether the results found in an experiment are meaningful. Answers the question: –Does.
1 Chapter 20 Two Categorical Variables: The Chi-Square Test.
Presentation 12 Chi-Square test.
Aaker, Kumar, Day Ninth Edition Instructor’s Presentation Slides
McGraw-Hill/IrwinCopyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 9 Hypothesis Testing.
Hypothesis Testing.
Statistical Analysis Statistical Analysis
 Involves testing a hypothesis.  There is no single parameter to estimate.  Considers all categories to give an overall idea of whether the observed.
Sullivan – Fundamentals of Statistics – 2 nd Edition – Chapter 11 Section 2 – Slide 1 of 25 Chapter 11 Section 2 Inference about Two Means: Independent.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 26 Comparing Counts.
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
Copyright © 2013 Pearson Education, Inc. All rights reserved Chapter 10 Inferring Population Means.
HAWKES LEARNING SYSTEMS Students Matter. Success Counts. Copyright © 2013 by Hawkes Learning Systems/Quant Systems, Inc. All rights reserved. Section 10.2.
Copyright © 2013, 2010 and 2007 Pearson Education, Inc. Chapter Inference on Categorical Data 12.
Chapter 11: Applications of Chi-Square. Count or Frequency Data Many problems for which the data is categorized and the results shown by way of counts.
6.5 One and Two sample Inference for Proportions np>5; n(1-p)>5 n independent trials; X=# of successes p=probability of a success Estimate:
Chapter 9: Non-parametric Tests n Parametric vs Non-parametric n Chi-Square –1 way –2 way.
Chi-squared Tests. We want to test the “goodness of fit” of a particular theoretical distribution to an observed distribution. The procedure is: 1. Set.
Copyright © 2009 Pearson Education, Inc LEARNING GOAL Interpret and carry out hypothesis tests for independence of variables with data organized.
A Course In Business Statistics 4th © 2006 Prentice-Hall, Inc. Chap 9-1 A Course In Business Statistics 4 th Edition Chapter 9 Estimation and Hypothesis.
Chapter 12 A Primer for Inferential Statistics What Does Statistically Significant Mean? It’s the probability that an observed difference or association.
CHAPTER 9 Testing a Claim
Essential Question:  How do scientists use statistical analyses to draw meaningful conclusions from experimental results?
Slide 26-1 Copyright © 2004 Pearson Education, Inc.
+ Chi Square Test Homogeneity or Independence( Association)
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 8 Hypothesis Testing.
BPS - 5th Ed. Chapter 221 Two Categorical Variables: The Chi-Square Test.
Learning Objectives Copyright © 2002 South-Western/Thomson Learning Statistical Testing of Differences CHAPTER fifteen.
Copyright © 2010 Pearson Education, Inc. Slide
Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.
© Copyright McGraw-Hill CHAPTER 11 Other Chi-Square Tests.
4 normal probability plots at once par(mfrow=c(2,2)) for(i in 1:4) { qqnorm(dataframe[,1] [dataframe[,2]==i],ylab=“Data quantiles”) title(paste(“yourchoice”,i,sep=“”))}
Slide 1 Copyright © 2004 Pearson Education, Inc..
Copyright © 2010 Pearson Education, Inc. Warm Up- Good Morning! If all the values of a data set are the same, all of the following must equal zero except.
© Copyright McGraw-Hill 2004
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 11 Analyzing the Association Between Categorical Variables Section 11.2 Testing Categorical.
Lecture PowerPoint Slides Basic Practice of Statistics 7 th Edition.
Comparing Counts Chapter 26. Goodness-of-Fit A test of whether the distribution of counts in one categorical variable matches the distribution predicted.
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 9 Testing a Claim 9.2 Tests About a Population.
BPS - 5th Ed. Chapter 221 Two Categorical Variables: The Chi-Square Test.
+ Section 11.1 Chi-Square Goodness-of-Fit Tests. + Introduction In the previous chapter, we discussed inference procedures for comparing the proportion.
The Practice of Statistics, 5th Edition Starnes, Tabor, Yates, Moore Bedford Freeman Worth Publishers CHAPTER 11 Inference for Distributions of Categorical.
Chapter 12 Tests of Hypotheses Means 12.1 Tests of Hypotheses 12.2 Significance of Tests 12.3 Tests concerning Means 12.4 Tests concerning Means(unknown.
Slide 1 Copyright © 2004 Pearson Education, Inc. Chapter 11 Multinomial Experiments and Contingency Tables 11-1 Overview 11-2 Multinomial Experiments:
Hypothesis Tests for 1-Proportion Presentation 9.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
Class Seven Turn In: Chapter 18: 32, 34, 36 Chapter 19: 26, 34, 44 Quiz 3 For Class Eight: Chapter 20: 18, 20, 24 Chapter 22: 34, 36 Read Chapters 23 &
Chapter 9 Hypothesis Testing Understanding Basic Statistics Fifth Edition By Brase and Brase Prepared by Jon Booze.
CHI SQUARE DISTRIBUTION. The Chi-Square (  2 ) Distribution The chi-square distribution is the probability distribution of the sum of several independent,
Copyright © 2009 Pearson Education, Inc LEARNING GOAL Interpret and carry out hypothesis tests for independence of variables with data organized.
Chapter 12 Tests with Qualitative Data
Chi Square (2) Dr. Richard Jackson
Inference on Categorical Data
Analyzing the Association Between Categorical Variables
Presentation transcript:

Chapter 14 Tests of Hypotheses Based on Count Data 14.2 Tests concerning proportions (large samples) 14.3 Differences between proportions 14.4 The analysis of an r x c table

14.2 Tests concerning proportions (large samples) np>5; n(1-p)>5 n independent trials; X=# of successes p=probability of a success Estimate:

Tests of Hypotheses Null H0: p=p0 Possible Alternatives: HA: p<p0

Test Statistics Under H0, p=p0, and Statistic: is approximately standard normal under H0 . Reject H0 if z is too far from 0 in either direction.

Rejection Regions Alternative Hypotheses HA: p>p0 HA: p<p0 z>z z<-z z>z/2 or z<-z/2

Equivalent Form:

Example 14.1 H0: p=0.75 vs HA: p0.75 =0.05 n=300 x=206 Reject H0 if z<-1.96 or z>1.96

Observed z value Conclusion: reject H0 since z<-1.96 P(z<-2.5 or z>2.5)=0.0124<a reject H0.

Example 14.2 Toss a coin 100 times and you get 45 heads Estimate p=probability of getting a head Is the coin balanced one? a=0.05 Solution: H0: p=0.50 vs HA: p0.50

Enough Evidence to Reject H0? Critical value z0.025=1.96 Reject H0 if z>1.96 or z<-1.96 Conclusion: accept H0

Another example The following table is for a certain screening test 910 10 Results Negative 80 140 Result Positive Cancer Absent Cancer Present FNA status Truth = surgical biopsy Total 220 920 150 990 1140

Test to see if the sensitivity of the screening test is less than 97%. Hypothesis Test statistic The test statistic z is calculated by taking the observed difference between the two proportions and dividing it by the standard error of the difference between the two proportions.

What is the conclusion? Check p-value when z=-2.6325, p-value = 0.004 Conclusion: we can reject the null hypothesis at level 0.05.

One word of caution about sample size: If we decrease the sample size by a factor of 10, 91 1 Results Negative 8 14 Result Positive Cancer Absent Cancer Present FNA status Truth = surgical biopsy Total 22 92 15 99 114

And if we try to use the z-test, P-value is greater than 0.05 for sure (p=0.2026). So we cannot reach the same conclusion. And this is wrong!

So for test concerning proportions We want np>5; n(1-p)>5

14.3 Differences Between Proportions Two drugs (two treatments) p1 =percentage of patients recovered after taking drug 1 p2 =percentage of patients recovered after taking drug 2 Compare effectiveness of two drugs

Tests of Hypotheses Null H0: p1=p2 (p1-p2 =0) Possible Alternatives: HA: p1<p2 HA: p1>p2 HA: p1p2

Compare Two Proportions Drug 1: n1 patients, x1 recovered Drug 2: n2 patients, x2 recovered Estimates: Statistic for test: If we did this study over and over and drew a histogram of the resulting values of , that histogram or distribution would have standard deviation

Estimating the Standard Error Under H0, p1=p2=p. So Estimate the common p by

So put them together

Example 12.3 Two sided test: H0: p1=p2 vs HA: p1p2 n1=80, x1=56

Two Tailed Test Observed z-value: Critical value for two-tailed test: 1.96 Conclusion: Reject H0 since |z|>1.96

Rejection Regions Alternative Hypotheses HA: p1>p2 HA: p1<p2 z>z z<-z z>z/2 or z<-z/2

P-value of the previous example P-value=P(z<-2.88)+P(z>2.88)=2*0.004 So not only we can reject H0 at 0.05 level, we can also reject at 0.01 level.

14.4 The analysis of an r x c table Recall Example 12.3 Two sided test; H0: p1=p2 vs HA: p1p2 n1=80, x1=56 n2=80, x2=38 We can put this into a 2x2 table and the question now becomes is there a relationship between treatment and outcome? We will come back to this example after we introduce 2x2 tables and chi-square test. 42 24 38 56 recover Not recover trt1 trt2 80 94 66

2x2 Contingency Table The table shows the data from a study of 91 patients who had a myocardial infarction (Snow 1965). One variable is treatment (propranolol versus a placebo), and the other is outcome (survival for at least 28 days versus death within 28 days). Treatment 17 29 7 38 OUTCOME Survival for at least 28 days Death Propranolol Placebo Total 45 46 91 67 24

Hypotheses for Two-way Tables The hypotheses for two-way tables are very “broad stroke”. The null hypothesis H0 is simply that there is no association between the row and column variable. The alternative hypothesis Ha is that there is an association between the two variables. It doesn’t specify a particular direction and can’t really be described as one-sided or two-sided.

Hypothesis statement in Our Example Null hypothesis: the method of treating the myocardial infarction patients did not influence the proportion of patients who survived for at least 28 days. The alternative hypothesis is that the outcome (survival or death) depended on the treatment, meaning that the outcomes was the dependent variable and the treatment was the independent variable.

Calculation of Expected Cell Count To test the null hypothesis, we compare the observed cell counts (or frequencies) to the expected cell counts (also called the expected frequencies) The process of comparing the observed counts with the expected counts is called a goodness-of-fit test. (If the chi-square value is small, the fit is good and the null hypothesis is not rejected.)

Observed cell counts 17 29 7 38 Expected cell counts 12.13 33.87 11.87 Treatment 17 29 7 38 OUTCOME Survival for at least 28 days Death Propranolol Placebo Total 45 46 91 67 24 Expected cell counts Treatment 12.13 33.87 11.87 33.13 OUTCOME Survival for at least 28 days Death Propranolol Placebo Total 45 46 91 67 24

The Chi-Square ( c2) Test Statistic The chi-square statistic is a measure of how much the observed cell counts in a two-way table differ from the expected cell counts. It can be used for tables larger than 2 x 2, if the average of the expected cell counts is > 5 and the smallest expected cell count is > 1; and for 2 x 2 tables when all 4 expected cell counts are > 5. The formula is: c2 = S(observed count – expected count)2/expected count Degrees of freedom (df) = (r –1) x (c – 1) Where “observed” is an observed sample count and “expected” is the computed expected cell count for the same cell, r is the number of rows, c is the number of columns, and the sum (S) is over all the r x c cells in the table (these do not include the total cells). If the expected counts and observed counts are very different, a large chi-square will result. Large values provide evidence AGAINST the null hypothesis.

The Chi-Square ( c2) Test Statistic

Example: Patient Compliance w/ Rx In a study of 100 patients with hypertension, 50 were randomly allocated to a group prescribed 10 mg lisinopril to be taken once daily, while the other 50 patients were prescribed 5 mg lisinopril to be taken twice daily. At the end of the 60 day study period the patients returned their remaining medication to the research pharmacy. The pharmacy then counted the remaining pills and classified each patient as < 95% or 95%+ compliant with their prescription. The two-way table for Compliance and Treatment was: Treatment Compliance 10 mg Daily 5 mg bid Total 95%+ 46 40 86 < 95% 4 10 14 Total 50 50 100

Example: Patient Compliance w/ Rx Treatment Compliance 10 mg Daily 5 mg bid Total 95%+ 460 400 860 < 95% 40 100 140 Total 500 500 1000 Treatment Compliance 10 mg Daily 5 mg bid Total 95%+ 430 430 860 < 95% 70 70 140 Total 500 500 1000 The expected cell counts were: Expect cell counts: Both 95% counts = (86*50)/100 = 4300/100 = 43 & Both <95% counts = (14*50)/100 = 700/100 = 7 Chi-square = ((46-43)2/43)+((40-43)2/43)+((4-7)2/7)+((10-7)2/7) = (9/43) + (9/43) + (9/7) + (9/7) = 2.99 The P-value comes from Table A, for a z of 1.73, because sqrt(2.99) = 1.7291 So, there is no association between Compliance and Treatment at an a = 0.05 level. c2 = 29.9, df = (2-1)*(2-1) = 1, P-value <0.001

If we use the two sample test for proportion

The c2 and z Test Statistics The comparison of the proportions of “successes” in two populations leads to a 2 x 2 table, so the population proportions can be compared either using the c2 test or the two-sample z test . It really doesn’t matter, because they always give exactly the same result, because the c2 is equal to the square of the z statistic and the chi-square with one degree of freedom c2(1) critical values are equal to the squares of the corresponding z critical values. A P-value for the 2 x 2 c2 can be found by calculating the square root of the chi-square, looking that up in Table for P(Z > z) and multiplying by 2, because the chi-square always tests the two-sided alternative. For a 2 x 2 table with a one-sided alternative hypothesis the two-sample z statistic would need to be used. To test more than two populations the chi-square must be used The chi-square is the one most often seen in the literature

Summary: Computations for Two-way Tables create the table, including observed cell counts, column and row totals. Find the expected cell counts. Determine if a c2 test is appropriate Calculate the c2 statistic and number of degrees of freedom Find the approximate P-value use Table III chi-square table to find the approximate P-value or use z-table and find the two-tailed p-value if it is 2 x 2. 3. If the chi-square is convertedd to a z statistic, it is always considered a two sided test statistic. Draw conclusions about the association between the row and column variables.

Yates Correction for Continuity The chi-square test is based on the normal approximation of the binomial distribution (discrete), many statisticians believe a correction for continuity is needed. It makes little difference if the numbers in the table are large, but in tables with small numbers it is worth doing. It reduces the size of the chi-square value and so reduces the chance of finding a statistically significant difference, so that correction for continuity makes the test more conservative.

What do we do if the expected values in any of the cells in a 2x2 table is below 5? For example, a sample of teenagers might be divided into male and female on the one hand, and those that are and are not currently dieting on the other. We hypothesize, perhaps, that the proportion of dieting individuals is higher among the women than among the men, and we want to test whether any difference of proportions that we observe is significant. The data might look like this: men women total dieting 1 9 10 not dieting 11 3 14 totals 12 24

The question we ask about these data is: knowing that 10 of these 24 teenagers are dieters, what is the probability that these 10 dieters would be so unevenly distributed between the girls and the boys? If we were to choose 10 of the teenagers at random, what is the probability that 9 of them would be among the 12 girls, and only 1 from among the 12 boys? --Hypergeometric distribution! --Fisher’s exact test uses hypergeometric distribution to calculate the “exact” probability of obtaining such set of the values.

Fisher’s exact test Before we proceed with the Fisher test, we first introduce some notation. We represent the cells by the letters a, b, c and d, call the totals across rows and columns marginal totals, and represent the grand total by n. So the table now looks like this: men women total dieting a b a + b not dieting c d c + d totals a + c b + d n

men women total dieting a b a + b not dieting c d c + d totals a + c b + d n Fisher showed that the probability of obtaining any such set of values was given by the hypergeometric distribution:                                   

More extreme than observed In our example More extreme than observed As extreme as observed 24 12 totals 14 3 11 not dieting 10 9 1 dieting total women men 2 Recall that p-value is the probability of observing data as extreme or more extreme if the null hypothesis is true. So the p-value is this problem is 0.00137.

The fisher Exact Probability Test Used when one or more of the expected counts in a contingency table is small (<2). Fisher's Exact Test is based on exact probabilities from a specific distribution (the hypergeometric distribution). There's really no lower bound on the amount of data that is needed for Fisher's Exact Test. You can use Fisher's Exact Test when one of the cells in your table has a zero in it. Fisher's Exact Test is also very useful for highly imbalanced tables. If one or two of the cells in a two by two table have numbers in the thousands and one or two of the other cells has numbers less than 5, you can still use Fisher's Exact Test. Fisher's Exact Test has no formal test statistic and no critical value, and it only gives you a p-value. The Chi-square test relies on a large sample approximation. Therefore, you may prefer to use Fishers Exact test in situations where a large sample approximation is inappropriate.