Presentation is loading. Please wait.

Presentation is loading. Please wait.

EPI809/Spring 2008 1 Chapter 10 Hypothesis testing: Categorical Data Analysis.

Similar presentations


Presentation on theme: "EPI809/Spring 2008 1 Chapter 10 Hypothesis testing: Categorical Data Analysis."— Presentation transcript:

1 EPI809/Spring Chapter 10 Hypothesis testing: Categorical Data Analysis

2 EPI809/Spring Learning Objectives 1. Comparison of binomial proportion using Z and 2 Test. 2. Explain 2 Test for Independence of 2 variables 3. Explain The Fishers test for independence 4. McNemars tests for correlated data 5. Kappa Statistic 6. Use of SAS Proc FREQ

3 EPI809/Spring Data Types

4 EPI809/Spring Qualitative Data 1. Qualitative Random Variables Yield Responses That Can Be Put In Categories. Example: Gender (Male, Female) 2. Measurement or Count Reflect # in Category 3. Nominal (no order) or Ordinal Scale (order) 4. Data can be collected as continuous but recoded to categorical data. Example (Systolic Blood Pressure - Hypotension, Normal tension, hypertension )

5 EPI809/Spring Hypothesis Tests Qualitative Data

6 EPI809/Spring Z Test for Differences in Two Proportions

7 EPI809/Spring Hypotheses for Two Proportions

8 EPI809/Spring Hypotheses for Two Proportions

9 EPI809/Spring Hypotheses for Two Proportions

10 EPI809/Spring Hypotheses for Two Proportions

11 EPI809/Spring Hypotheses for Two Proportions

12 EPI809/Spring Hypotheses for Two Proportions

13 EPI809/Spring Z Test for Difference in Two Proportions 1.Assumptions Populations Are Independent Populations Are Independent Populations Follow Binomial Distribution Populations Follow Binomial Distribution Normal Approximation Can Be Used for large samples (All Expected Counts 5) Normal Approximation Can Be Used for large samples (All Expected Counts 5) 2. Z-Test Statistic for Two Proportions

14 EPI809/Spring Sample Distribution for Difference Between Proportions

15 EPI809/Spring Z Test for Two Proportions Thinking Challenge Youre an epidemiologist for the US Department of Health and Human Services. Youre studying the prevalence of disease X in two states (MA and CA). In MA, 74 of 1500 people surveyed were diseased and in CA, 129 of 1500 were diseased. At.05 level, does MA have a lower prevalence rate? Youre an epidemiologist for the US Department of Health and Human Services. Youre studying the prevalence of disease X in two states (MA and CA). In MA, 74 of 1500 people surveyed were diseased and in CA, 129 of 1500 were diseased. At.05 level, does MA have a lower prevalence rate? MA CA

16 EPI809/Spring Z Test for Two Proportions Solution*

17 EPI809/Spring Test Statistic: Decision:Conclusion: Z Test for Two Proportions Solution* H 0 : H a : = = n MA = n CA = Critical Value(s):

18 EPI809/Spring Test Statistic: Decision:Conclusion: Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 = = n MA = n CA = Critical Value(s):

19 EPI809/Spring Test Statistic: Decision:Conclusion: Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 =.05 =.05 n MA = 1500 n CA = 1500 Critical Value(s):

20 EPI809/Spring Test Statistic: Decision:Conclusion: Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 =.05 =.05 n MA = 1500 n CA = 1500 Critical Value(s):

21 EPI809/Spring Z Test for Two Proportions Solution*

22 EPI809/Spring Z = Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 =.05 =.05 n MA = 1500 n CA = 1500 Critical Value(s): Test Statistic: Decision:Conclusion:

23 EPI809/Spring Z = Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 =.05 =.05 n MA = 1500 n CA = 1500 Critical Value(s): Test Statistic: Decision:Conclusion: Reject at =.05

24 EPI809/Spring Z = Z Test for Two Proportions Solution* H 0 : p MA - p CA = 0 H a : p MA - p CA < 0 =.05 =.05 n MA = 1500 n CA = 1500 Critical Value(s): Test Statistic: Decision:Conclusion: Reject at =.05 There is evidence MA is less than CA

25 EPI809/Spring Test of Independence Between 2 Categorical Variables 2 Test of Independence Between 2 Categorical Variables

26 EPI809/Spring Hypothesis Tests Qualitative Data

27 EPI809/Spring Test of Independence 2 Test of Independence 1.Shows If a Relationship Exists Between 2 Qualitative Variables, but does Not Show Causality 2.Assumptions Multinomial Experiment All Expected Counts 5 3.Uses Two-Way Contingency Table

28 EPI809/Spring Test of Independence Contingency Table 2 Test of Independence Contingency Table 1.Shows # Observations From 1 Sample Jointly in 2 Qualitative Variables 1.Shows # Observations From 1 Sample Jointly in 2 Qualitative Variables

29 EPI809/Spring Test of Independence Contingency Table 2 Test of Independence Contingency Table 1.Shows # Observations From 1 Sample Jointly in 2 Qualitative Variables Levels of variable 2 Levels of variable 1

30 EPI809/Spring Test of Independence Hypotheses & Statistic 2 Test of Independence Hypotheses & Statistic 1.Hypotheses H 0 : Variables Are Independent H 0 : Variables Are Independent H a : Variables Are Related (Dependent) H a : Variables Are Related (Dependent)

31 EPI809/Spring Test of Independence Hypotheses & Statistic 2 Test of Independence Hypotheses & Statistic 1.Hypotheses H 0 : Variables Are Independent H a : Variables Are Related (Dependent) 2.Test Statistic Observed count Expected count

32 EPI809/Spring Test of Independence Hypotheses & Statistic 2 Test of Independence Hypotheses & Statistic 1.Hypotheses H 0 : Variables Are Independent H a : Variables Are Related (Dependent) 2.Test Statistic Degrees of Freedom: (r - 1)(c - 1) Rows Columns Observed count Expected count

33 EPI809/Spring Test of Independence Expected Counts 2 Test of Independence Expected Counts 1.Statistical Independence Means Joint Probability Equals Product of Marginal Probabilities 2.Compute Marginal Probabilities & Multiply for Joint Probability 3.Expected Count Is Sample Size Times Joint Probability

34 EPI809/Spring Expected Count Example

35 EPI809/Spring Expected Count Example Marginal probability =

36 EPI809/Spring Expected Count Example Marginal probability =

37 EPI809/Spring Expected Count Example Marginal probability = Joint probability =

38 EPI809/Spring Expected Count Example Marginal probability = Joint probability = Expected count = 160· = 54.6

39 EPI809/Spring Expected Count Calculation

40 EPI809/Spring Expected Count Calculation

41 EPI809/Spring Expected Count Calculation 112x x x x78 160

42 EPI809/Spring You randomly sample 286 sexually active individuals and collect information on their HIV status and History of STDs. At the.05 level, is there evidence of a relationship? You randomly sample 286 sexually active individuals and collect information on their HIV status and History of STDs. At the.05 level, is there evidence of a relationship? 2 Test of Independence Example on HIV 2 Test of Independence Example on HIV

43 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution

44 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : H a : = = df = Critical Value(s): Test Statistic: Decision:Conclusion:

45 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship = = df = Critical Value(s): Test Statistic: Decision:Conclusion:

46 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship =.05 =.05 df = (2 - 1)(2 - 1) = 1 Critical Value(s): Test Statistic: Decision:Conclusion:

47 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship =.05 =.05 df = (2 - 1)(2 - 1) = 1 Critical Value(s): Test Statistic: Decision:Conclusion: =.05 =.05

48 EPI809/Spring E(n ij ) 5 in all cells 170x x x x Test of Independence Solution 2 Test of Independence Solution

49 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution

50 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship =.05 =.05 df = (2 - 1)(2 - 1) = 1 Critical Value(s): Test Statistic: Decision:Conclusion: =.05 =.05 2 = = 54.29

51 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship =.05 =.05 df = (2 - 1)(2 - 1) = 1 Critical Value(s): Test Statistic: Decision:Conclusion: Reject at =.05 =.05 =.05 2 = = 54.29

52 EPI809/Spring Test of Independence Solution 2 Test of Independence Solution H 0 : No Relationship H a : Relationship =.05 =.05 df = (2 - 1)(2 - 1) = 1 Critical Value(s): Test Statistic: Decision:Conclusion: Reject at =.05 There is evidence of a relationship =.05 =.05 2 = = 54.29

53 EPI809/Spring Test of Independence SAS CODES 2 Test of Independence SAS CODES Data dis; input STDs HIV count; cards; ; run; Proc freq data=dis order=data; weight Count; weight Count; tables STDs*HIV/chisq; tables STDs*HIV/chisq; run;

54 EPI809/Spring Test of Independence SAS OUTPUT 2 Test of Independence SAS OUTPUT Statistics for Table of STDs by HIV Statistic DF Value Prob Chi-Square <.0001 Likelihood Ratio Chi-Square <.0001 Continuity Adj. Chi-Square <.0001 Mantel-Haenszel Chi-Square <.0001 Phi Coefficient Contingency Coefficient Cramer's V


Download ppt "EPI809/Spring 2008 1 Chapter 10 Hypothesis testing: Categorical Data Analysis."

Similar presentations


Ads by Google