1 2 test for independence 2 test for independence

17
1 2 2 Test for Test for Independence Independence

Upload: sofia-oconnell

Post on 27-Mar-2015

239 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 2 Test for Independence 2 Test for Independence

11

22 Test for Independence Test for Independence

Page 2: 1 2 Test for Independence 2 Test for Independence

22

Data TypesData Types

Data

Quantitative Qualitative

Discrete Continuous

Data

Quantitative Qualitative

Discrete Continuous

Page 3: 1 2 Test for Independence 2 Test for Independence

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.

Page 4: 1 2 Test for Independence 2 Test for Independence

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

Page 5: 1 2 Test for Independence 2 Test for Independence

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

Page 6: 1 2 Test for Independence 2 Test for Independence

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

Page 7: 1 2 Test for Independence 2 Test for Independence

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)

Page 8: 1 2 Test for Independence 2 Test for Independence

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

Page 9: 1 2 Test for Independence 2 Test for Independence

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

Page 10: 1 2 Test for Independence 2 Test for Independence

1010

Expected Count ExampleExpected Count Example

Page 11: 1 2 Test for Independence 2 Test for Independence

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 =

Page 12: 1 2 Test for Independence 2 Test for Independence

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 =

Page 13: 1 2 Test for Independence 2 Test for Independence

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

Page 14: 1 2 Test for Independence 2 Test for Independence

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

Page 15: 1 2 Test for Independence 2 Test for Independence

1515

Expected Count CalculationExpected Count Calculation

Page 16: 1 2 Test for Independence 2 Test for Independence

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

Page 17: 1 2 Test for Independence 2 Test for Independence

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