Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 2 Test for Independence 2 Test for Independence.

Similar presentations


Presentation on theme: "1 2 Test for Independence 2 Test for Independence."— Presentation transcript:

1 1 2 Test for Independence 2 Test for Independence

2 2 Data Types

3 3 Hypothesis Tests Qualitative Data

4 4 2 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

5 5 2 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

6 6 2 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

7 7 2 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)

8 8 2 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

9 9 2 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

10 10 Expected Count Example

11 11 Expected Count Example 112 160 Marginal probability =

12 12 Expected Count Example 112 160 78 160 Marginal probability =

13 13 Expected Count Example 112 160 78 160 Marginal probability = Joint probability = 112 160 78 160

14 14 Expected Count Example 112 160 78 160 Marginal probability = Joint probability = 112 160 78 160 Expected count = 160· 112 160 78 160 = 54.6

15 15 Expected Count Calculation

16 16 Expected Count Calculation

17 17 Expected Count Calculation 112x82 160 48x78 160 48x82 160 112x78 160

18 18 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

19 19 2 Test of Independence Solution 2 Test of Independence Solution

20 20 2 Test of Independence Solution 2 Test of Independence Solution H 0 : H a : = = df = Critical Value(s): Test Statistic: Decision:Conclusion:

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

22 EPI809/Spring 200822 2 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:

23 23 2 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

24 24 E(n ij ) 5 in all cells 170x132 286 170x154 286 116x132 286 154x116 286 2 Test of Independence Solution 2 Test of Independence Solution

25 25 2 Test of Independence Solution 2 Test of Independence Solution

26 26 2 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 2 = 54.29

27 27 2 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 2 = 54.29

28 28 2 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 2 = 54.29

29 The procedure to test for the independence: 1. State a hypotheses based on the fit of the data 2. Make a table of the observed and expected values. You will most likely be given the observed values. 3. Calculate the chi-squared test statistic, this is 4. Look up the chi-squared critical value from your chi-squared tables in the information booklet. 5. Compare your test statistic with your critical value and make a conclusion. If the test statistic lies in the critical region then reject H 0 in favour of H 1. Otherwise do not reject H 0 in favour of H 1. At first glance this is similar to the goodness of fit test, but the test statistic is worked out differently.

30 Degrees of freedom, v. When undertaking a chi-squared test you will have a table of observed and expected values. The degrees of freedom will be defined as: v=(number of rows-1)(number of columns-1) The chi-squared distribution. The distribution will alter depending on the value of v. The general curve is shown opposite.

31 Example of Chi-squared independence test The headmaster of a large IB school is concerned that the maths results are dependent on the maths teacher. There are 3 SL teachers and the results for each class have been shown below. These are the observed values. Test at the 5% level of significance to see if the grades are independent of the teacher. 1234567Total Mr. P235431018 Ms. Q125641120 Mrs. R 012551216 Total361215123354 Make your hypotheses: H 0 : the grade at maths SL is independent of the teacher. H 1 : the grade at maths SL is not independent of the teacher. Make a table of expected values. To do this take each row total x column total and divide by the grand total. This is shown opposite. This value is the expected value for this cell. Find the expected number of grade 2s that Mr. P gets. Complete a table of expected values.

32 1234567Total Mr. P235431018 Ms. Q125641120 Mrs. R 012551216 Total361215123354 continued.... Observed Expected 1234567Total Mr. P124541118 Ms. Q 1.1 1 2.2 2 4.4 4 5.5 6 4.4 4 1.1 1 20 Mrs. R 0.8 9 1.7 8 3.5 6 4.4 4 3.5 6 0.8 9 16 Total361215123354 Calculate the chi squared test statistic: Find the critical value from your tables. v=(7-1)(3-1)=12 Critical value = 21.026 Make your conclusion: Do not reject the null hypothesis. At the 5% level of significance there is no evidence to suggest that the choice of teacher influences the grade achieved. the p value


Download ppt "1 2 Test for Independence 2 Test for Independence."

Similar presentations


Ads by Google