Lecture 2

29
Biostatistik ST8 2007 Lecture 2 Lecture 2 Analyse af krydstabeller (cross-tabulations)

description

Analyse af krydstabeller (cross-tabulations). Lecture 2. Krydstabeller. Tabeller af tællelige enheder eller frekvenser Krydstabel analyse er lavet til at analysere association, relation, sammenhæng mellem to variable Denne sammenhæng er vanskelig at beskrive statistisk - PowerPoint PPT Presentation

Transcript of Lecture 2

Page 1: Lecture 2

Biostatistik ST8 2007

Lecture 2Lecture 2

Analyse af krydstabeller

(cross-tabulations)

Page 2: Lecture 2

Biostatistik ST8 2007

KrydstabellerKrydstabeller• Tabeller af tællelige enheder eller

frekvenser

• Krydstabel analyse er lavet til at analysere association, relation, sammenhæng mellem to variable

• Denne sammenhæng er vanskelig at beskrive statistisk

• Nul- hypotesen: ”Der er ingen sammenhæng mellem de to variable”

Page 3: Lecture 2

Biostatistik ST8 2007

Chi- kvadrat testen Chi- kvadrat testen • χ2 - test

• Bruges til krydstabel analyse af tabeller med store samples

• Nul- Hypotesen er at der ikke er nogen sammenhæng mellem de to variable.

Page 4: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstypeFødsel og bopælstype

Bopælstype Før termin Til termin I alt

Ejerbolig 50 849 899

Offentlig leje 29 229 258

Privat leje 11 164 175

Bor hos forældre 6 66 72

Andet 3 36 39

I alt 99 1344 1443

Page 5: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstypeFødsel og bopælstype

• Forventede antal hvis der ikke er nogen sammenhæng mellem fødsel og bopælstype

Bopælstype Før termin Til termin I alt

Ejerbolig 899

Offentlig leje 258

Privat leje 175

Bor hos forældre 72

Andet 39

I alt 99 1344 1443

Page 6: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstype Fødsel og bopælstype hvis nul-hypotesen er sandhvis nul-hypotesen er sand

• 899/1443 = 62.3% er husejere.• 62.3% af dem, der fødte før termin, skulle være

husejere: 99*62.3% = 99*899/1443 = 61.7

Bopælstype Før termin Til termin I alt

Ejerbolig 61.7 899

Offentlig leje 258

Privat leje 175

Bor hos forældre 72

Andet 39

I alt 99 1344 1443

Page 7: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstype Fødsel og bopælstype hvis nul-hypotesen er sandhvis nul-hypotesen er sand

• 899/1443 = 62.3% er husejere.• 62.3% af dem, der fødte til terminen, skulle være

husejere : 1344*899/1443 = 837.3

Bopælstype Før termin Til termin I alt

Ejerbolig 61.7 837.3 899

Offentlig leje 258

Privat leje 175

Bor hos forældre 72

Andet 39

I alt 99 1344 1443

Page 8: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstype Fødsel og bopælstype hvis nul-hypotesen er sandhvis nul-hypotesen er sand

• 258/1443 = 17.9% bor til offentlig leje.• 17.9% af dem, der fødte før terminen, skulle bo til

offentlig leje: 99*258/1443 = 17.7

Housing tenure Pre Term Total

Owner-occupier 61.7 837.3 899

Council tenant 17.7 258

Private tenant 175

Lives with parents 72

Other 39

Total 99 1344 1443

Page 9: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstype Fødsel og bopælstype hvis nul-hypotesen er sandhvis nul-hypotesen er sand

• generalt

Housing tenure Pre Term Total

Owner-occupier 61.7 837.3 899

Council tenant 17.7 240.3 258

Private tenant 12.0 163.0 175

Lives with parents 4.9 67.1 72

Other 2.7 36.3 39

Total 99 1344 1443

row total * column total

grand total

Page 10: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstype Fødsel og bopælstype hvis nul-hypotesen er sandhvis nul-hypotesen er sand

Observeret Forventet

Housing tenure Før termin Til termin Før termin Til termin I alt

Owner-occupier 50 849 61.7 837.3 899

Council tenant 29 229 17.7 240.3 258

Private tenant 11 164 12.0 163.0 175

Lives with parents 6 66 4.9 67.1 72

Other 3 36 2.7 36.3 39

Total 99 1344 99 1344 1443

2

2

all_cells

O E

E

Page 11: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstypeFødsel og bopælstypeTest for sammenhængTest for sammenhæng

• Hvis nul- hypotesen er sand og tallene er store vil tabellen være chi- kvadrat fordelt

• Antallet af frihedsgrader er (r-1)(k-1) = 4

2

2

all_cells

10.5O E

E

Page 12: Lecture 2

Biostatistik ST8 2007

Fødsel og bopælstypeFødsel og bopælstypeTest for sammenhængTest for sammenhæng

• df = 4• 1-5% sandsynlighed

for at H0 er sand

• SPSS: ’bolig.sav’ etc

2

2

all_cells

10.5O E

E

Page 13: Lecture 2

Biostatistik ST8 2007

2 x 2 tabeller2 x 2 tabeller

Bronkitis Ikke bronkitis Total

Hoste 26 44 70

Ingen hoste 247 1002 1249

Total 273 1046 1319

Page 14: Lecture 2

Biostatistik ST8 2007

2 x 2 tabeller2 x 2 tabeller

Bronkitis Uden bronkitis Total

Hoste 26 (14.49) 44 (55.51) 70

Ingen hoste 247 (258.51) 1002 (990.49) 1249

Total 273 1046 1319

2

2

all_cells

12.2O E

E

Antallet af frihedsgrader er 1

Page 15: Lecture 2

Biostatistik ST8 2007

Chi-kvadrat test for små samplesChi-kvadrat test for små samples

• Chi- kvadrat testen gælder ikke for små samples

• 80% af de forventede værdier skal være over 5

• Alle værdier skal være over 1Streptomycin Kontrol Total

Forbedring 13 (8.4) 5 (9.6) 18

Forværring 2 (4.2) 7 (4.8) 9

Død 0 (2.3) 5 (2.7) 5

Total 15 17 32

Page 16: Lecture 2

Biostatistik ST8 2007

Chi-kvadrat test for små samplesChi-kvadrat test for små samples

• Sammenføjning af grupperne

Streptomycin Kontrol Total

Forbedring 13 (8.4) 5 (9.6) 18

Forværring eller død

2 (6.6) 12 (7.4) 14

Total 15 17 32

2

2

all_cells

10.8O E

E

Page 17: Lecture 2

Biostatistik ST8 2007

Fisher’s exact testFisher’s exact test• Et eksempel

S D T

A 3 1 4

B 2 2 4

5 3 8

S D T

A 4 0 4

B 1 3 4

5 3 8

S D T

A 1 3 4

B 4 0 4

5 3 8

S D T

A 2 2 4

B 3 1 4

5 3 8

Page 18: Lecture 2

Biostatistik ST8 2007

Fisher’s exact testFisher’s exact test

• Overlevende:

a, b, c, d, e• Døde: f, g, h• Tabel 1 kan laves på

5 forskellige måder• Tabel 2: 30• Tabel 3: 30• Tabel 4: 5• 70 forskellige måder

S D T

A 3 1 4

B 2 2 4

5 3 8

S D T

A 4 0 4

B 1 3 4

5 3 8

S D T

A 1 3 4

B 4 0 4

5 3 8

S D T

A 2 2 4

B 3 1 4

5 3 8

Page 19: Lecture 2

Biostatistik ST8 2007

Yates’ korrektion for 2x2 Yates’ korrektion for 2x2 • Table 13.7

– Fisher: p = 0.00159– χ2: p = 0.00112– Yates’ p = 0.0037

Page 20: Lecture 2

Biostatistik ST8 2007

Odds and odds ratiosOdds and odds ratios• Odds

• Log odds / logit

1

po

p

ln( ) ln1

po

p

Page 21: Lecture 2

Biostatistik ST8 2007

Odds ratioOdds ratio

• Cough and Bronchitisp = 26/273 = 0.095

o = 26/247 = 0.105

Bronchitis No bronchitis Total

Cough 26 (a) 44 (b) 70

No Cough 247 (c) 1002 (d) 1249

Total 273 1046 1319

1

po

p

Page 22: Lecture 2

Biostatistik ST8 2007

Odds ratioOdds ratio

• Odds ratio: 0.105 / 0.0439 = 2.40

Bronchitis No bronchitis Total

Cough 0.105 (a) 0.0439 (b) 70

No Cough 9.50 (c) 22.8 (d) 1249

Total 273 1046 1319

ac

bd

ador

bc

ab

cd

ador

bc

Page 23: Lecture 2

Biostatistik ST8 2007

Odds ratioOdds ratio

Bronchitis No bronchitis Total

Cough 26 (a) 44 (b) 70

No Cough 247 (c) 1002 (d) 1249

Total 273 1046 1319

1 1 1 1SE ln a b c dor

1 1 1 126 44 247 1002SE ln 0.257or

ln( ) 0.874or

Page 24: Lecture 2

Biostatistik ST8 2007

Odds ratioOdds ratio

Bronchitis No bronchitis Total

Cough 26 (a) 44 (b) 70

No Cough 247 (c) 1002 (d) 1249

Total 273 1046 1319

1 1 1 1SE ln a b c dor

1 1 1 126 44 247 1002SE ln 0.257or

ln( ) 0.874or

Page 25: Lecture 2

Biostatistik ST8 2007

Odds ratio, ConfidenceOdds ratio, Confidence• ln (or) ± 1.96*SE(ln(or)) = 0.370 to 1.379

• Confidence of the odds ratio

• e0.370 to e1.379 = 1.45 to 3.97

Page 26: Lecture 2

Biostatistik ST8 2007

McNemar’s testMcNemar’s test

Cold at age 14 total

Yes No

Cold at age 12

Yes 212 144 356

No 256 707 963

total 468 851 1319

2 22 1 1

2 2

1 12 2

2

2

yn yn ny ny yn ny

yn ny yn ny

yn ny

yn ny

f f f f f fO E

E f f f f

f f

f f

Page 27: Lecture 2

Biostatistik ST8 2007

Yates correction for McNemarYates correction for McNemar

2

21yn ny

yn ny

f f

f f

Page 28: Lecture 2

Biostatistik ST8 2007

OpgaverOpgaver• Brug Chi kvadrat testen til at se om

streptomycin er effektivt mod tuberkulose (Tabel 2.10)

• Opgaver i kapitlet

Page 29: Lecture 2

Biostatistik ST8 2007

SpssSpss• Here is the code valid until 31st May 2007

• 4344d25c2c11a607cce3

• Code registration is required on-line after the installation.