Tests of 2 Proportions Contingency Tables

20
1 Tests of 2 Proportions Contingency Tables

description

Tests of 2 Proportions Contingency Tables. Example: Wearing Helmets + Head Injuries (see ch15). 2 sample: Helmut wearers: No Helmut wearers: Outcome: 1 if head injury; 0 otherwise. Example: Wearing Helmets + Head Injuries (see ch15). Contingency Tables. - PowerPoint PPT Presentation

Transcript of Tests of 2 Proportions Contingency Tables

Page 1: Tests of 2 Proportions Contingency Tables

1

Tests of 2 Proportions

Contingency Tables

Page 2: Tests of 2 Proportions Contingency Tables

2

Example: Wearing Helmets + Head Injuries (see ch15)

• 2 sample: Helmut wearers:• No Helmut wearers:• Outcome:

– 1 if head injury; – 0 otherwise

1 147n

2 646n

1

17ˆ 0.116

147p

2

218ˆ 0.337

646p

0 1 2

1 2

:

:a

H p p

H p p

0 1 2

1 2

: 0

: 0a

H p p

H p p

Page 3: Tests of 2 Proportions Contingency Tables

3

Example: Wearing Helmets + Head Injuries (see ch15)

1 147n

2 646n

1

17ˆ 0.116

147p

2

218ˆ 0.337

646p

0 1 2

1 2

: 0

: 0a

H p p

H p p

1 2

1 2

ˆ ˆ 0

1 1cal

p pz

p p p p

n n

1 1 2 2

1 2

ˆ ˆ 2350.296

793

n p n pp

n n

Page 4: Tests of 2 Proportions Contingency Tables

4

Contingency Tables

• Nominal data that are grouped into categories are often presented in the form of contingency tables

• Rows denote levels of one variable (e.g. disease)

• Columns denote the levels of the other variable (e.g. exposure)

Page 5: Tests of 2 Proportions Contingency Tables

5

Consider whether the rate of caesareans is different for subjects receiving an electronic fetal monitoring (EFM), as compared to those without EMF.Sample 5,824 deliveries:

of these 2,850 were EFM exposedand 2,974 were not.358 of the 2,850 had c-sectionsas did 229 of the 2,974.

Binomial with n huge.

Example – Discrete Outcomes

Page 6: Tests of 2 Proportions Contingency Tables

6

Chi square test

Proceed as usual:

1. If there is no difference (null hypothesis) what do we

expect to see?

2. How does this compare to what we have observed? (statistic & its distribution)

Do the c-section rates differ?

Example – Discrete Outcomes

Page 7: Tests of 2 Proportions Contingency Tables

7

Caesarean Delivery

EFM ExposureTotal

Yes No

Yes 358 229 587

No 2,492 2,745 5,237

Total 2,850 2,974 5,824

Data-Contingency table

If the c-section rate is the same in both populations, then ignore column classification and go with totals.

Page 8: Tests of 2 Proportions Contingency Tables

8

2x2 Table – Null Hypothesis

• Ho: The proportion of C-sections among patents receiving EFM is identical to the proportion of C-sections among patients who do not receive EMF

• Ha: The proportion of C-sections among patents receiving EFM is different from the proportion of C-sections among patients who do not receive EMF

Page 9: Tests of 2 Proportions Contingency Tables

9

From the totals we can estimate:

Probability of c-section

Page 10: Tests of 2 Proportions Contingency Tables

10

What do we expect to see if EFM has no effect?

EFM exposed (2,850 mothers):

No EFM (2,974 mothers)

Expected counts under Ho

Page 11: Tests of 2 Proportions Contingency Tables

11

C-sectEFM Exposure?

TotalYes No

Yes 358 287 229 300 587

No 2492 2563 2745 2674523

7

Total 2850 2974582

4

Expected, if independence of row andcolumn classification is true, in boxes:

Observed and Expected counts – Contingency Table

Page 12: Tests of 2 Proportions Contingency Tables

12

(Table page A-26)

Chi Square Goodness of fit

Chi Square Test

Page 13: Tests of 2 Proportions Contingency Tables

13

In 2x2 tables (only) we applya continuity correction factor:

Continuity correction factor

Page 14: Tests of 2 Proportions Contingency Tables

14

For the EFM and c-section example, above:

Example

Note: This is a 2 sided test

Page 15: Tests of 2 Proportions Contingency Tables

15

Equivalent Tests

• The above example can be analyzed equivalently using a two sample test of proportions (Chapter 14.6)

• 2 sample test of proportions (Z test) and Chi-Square test are mathematically equivalent

Page 16: Tests of 2 Proportions Contingency Tables

16

Assumptions – Chi Square test

• Chi square test – is an asymptotic test. i.e. Works only when sample size is large

• Chi Square test – treats the row total and column total of the data as fixed (i.e. not random)

Page 17: Tests of 2 Proportions Contingency Tables

17

Assumptions – 2 sample test of proportions

• Z test – is also an asymptotic test. Assumes that the Central Limit Theorem for sample means (i.e. proportions) holds. Thus this test is appropriate only when sample size is large

• Z test – assumes that the proportions in each group being compared are random variables

Page 18: Tests of 2 Proportions Contingency Tables

18

e.g. Accuracy of Death Certificates

Hospit.

Certificate Status

TotalConf.Accur.

Inacc.No Ch.

Incorr.Recode

Comm. 157 18 54 229

Teach. 268 44 34 346

Total 425 62 88 575

Extending to multiple categories: r x c Tables

Page 19: Tests of 2 Proportions Contingency Tables

19

Hospital

Certificate Status

TotalConfirmedAccurate

InaccurateNo Change

IncorrectRecoded

Comm. 157 169.3 18 24.7 54 35.0 229

Teach. 268 255.7 44 37.3 34 53.0 346

Total 425 62 88 575

tabi 157 18 54 \ 268 44 34

e.g.

Page 20: Tests of 2 Proportions Contingency Tables

20

Summary

• Contingency Tables – – Analysis of 2x2 tables– Analysis of rxc tables

• Equivalence between Chi square test and two sample test of proportions