Post on 27-Mar-2015
11
22 Test for Independence Test for Independence
22
Data TypesData Types
Data
Quantitative Qualitative
Discrete Continuous
Data
Quantitative Qualitative
Discrete Continuous
33
Hypothesis Tests Hypothesis Tests Qualitative Data Qualitative Data
QualitativeData
Z Test Z Test 2 Test
Proportion Independence1 pop.
2 Test
2 or morepop.
2 pop.
QualitativeData
Z Test Z Test 2 Test
Proportion Independence1 pop.
2 Test
2 or morepop.
2 pop.
44
22 Test of Independence Test of Independence
1.1.Shows If a Relationship Exists Between 2 Shows If a Relationship Exists Between 2 Qualitative Variables, but does Qualitative Variables, but does NotNot Show Show CausalityCausality
2.2.AssumptionsAssumptionsMultinomial ExperimentMultinomial Experiment
All Expected Counts All Expected Counts 5 5
3.3.Uses Two-Way Contingency TableUses Two-Way Contingency Table
55
22 Test of Independence Test of Independence Contingency Table Contingency Table
1.1. Shows # Observations From 1 Shows # Observations From 1 Sample Jointly in 2 Qualitative VariablesSample Jointly in 2 Qualitative Variables
66
Residence Disease Status
Urban Rural Total
Disease 63 49 112 No disease 15 33 48 Total 78 82 160
Residence Disease Status
Urban Rural Total
Disease 63 49 112 No disease 15 33 48 Total 78 82 160
22 Test of Independence Test of Independence Contingency Table Contingency Table
1.1.Shows # Observations From 1 Sample Shows # Observations From 1 Sample Jointly in 2 Qualitative VariablesJointly in 2 Qualitative Variables
Levels of variable 2Levels of variable 2
Levels of variable 1Levels of variable 1
77
22 Test of Independence Test of Independence Hypotheses & StatisticHypotheses & Statistic
1.1.HypothesesHypotheses HH00: Variables Are Independent : Variables Are Independent
HHaa: Variables Are Related (Dependent): Variables Are Related (Dependent)
88
22 Test of Independence Test of Independence Hypotheses & StatisticHypotheses & Statistic
1.1.HypothesesHypothesesHH00: Variables Are Independent : Variables Are Independent
HHaa: Variables Are Related (Dependent): Variables Are Related (Dependent)
2.2.Test StatisticTest Statistic Observed countObserved count
Expected Expected countcount
cells all
2
2
ˆ
ˆ
ij
ijij
nE
nEn
cells all
2
2
ˆ
ˆ
ij
ijij
nE
nEn
99
22 Test of Independence Test of Independence Hypotheses & StatisticHypotheses & Statistic
1.1.HypothesesHypothesesHH00: Variables Are Independent : Variables Are Independent
HHaa: Variables Are Related (Dependent): Variables Are Related (Dependent)
2.2.Test StatisticTest Statistic
Degrees of Freedom: (Degrees of Freedom: (rr - 1)( - 1)(cc - 1) - 1)RowsRows Columns Columns
Observed countObserved count
Expected Expected countcount 2
2
n E n
E n
ij ij
ij
c hc hall cells
2
2
n E n
E n
ij ij
ij
c hc hall cells
1010
Expected Count ExampleExpected Count Example
1111
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Expected Count ExampleExpected Count Example
112 112 160160
Marginal probability = Marginal probability =
1212
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Expected Count ExampleExpected Count Example
112 112 160160
78 78 160160
Marginal probability = Marginal probability =
Marginal probability = Marginal probability =
1313
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Expected Count ExampleExpected Count Example
112 112 160160
78 78 160160
Marginal probability = Marginal probability =
Marginal probability = Marginal probability =
Joint probability = Joint probability = 112 112 160160
78 78 160160
1414
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Residence Disease Urban Rural
Status Obs. Obs. Total
Disease 63 49 112
No Disease 15 33 48
Total 78 82 160
Expected Count ExampleExpected Count Example
112 112 160160
78 78 160160
Marginal probability = Marginal probability =
Marginal probability = Marginal probability =
Joint probability = Joint probability = 112 112 160160
78 78 160160
Expected count = 160· Expected count = 160· 112 112 160160
78 78 160160
= 54.6 = 54.6
1515
Expected Count CalculationExpected Count Calculation
1616
Expected Count CalculationExpected Count Calculation
Expected count = Row total Column total
Sample sizea fa f
Expected count = Row total Column total
Sample sizea fa f
1717
Residence Disease Urban Rural
Status Obs. Exp. Obs. Exp. Total
Disease 63 54.6 49 57.4 112
No Disease 15 23.4 33 24.6 48
Total 78 78 82 82 160
Residence Disease Urban Rural
Status Obs. Exp. Obs. Exp. Total
Disease 63 54.6 49 57.4 112
No Disease 15 23.4 33 24.6 48
Total 78 78 82 82 160
Expected Count CalculationExpected Count Calculation
112x82 112x82 160160
48x78 48x78 160160
48x82 48x82 160160
112x78 112x78 160160
Expected count = Row total Column total
Sample sizea fa f
Expected count = Row total Column total
Sample sizea fa f