lineare regression: tests - stat.ethz.ch · 12-minuten test nach cooper (1968) ... von vo2max bei...

26
Lineare Regression: Tests Statistik (Biol./Pharm./HST) FS 2015

Upload: others

Post on 21-Oct-2019

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Lineare Regression: Tests

Statistik (Biol./Pharm./HST) – FS 2015

Page 2: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Ersatz: Cooper & Shuttle

● 12-Minuten Test nach Cooper (1968)

● 20m-Shuttle-Test nach Leger (1982)

Page 3: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

𝛽0 = −19.46 𝛽1 = 5.86 𝜎 = 5.4

Methode der kleinsten Quadrate

Page 4: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

y = 45

y = -19.46 + 5.86 * 11

𝛽0 = −19.46 𝛽1 = 5.86 𝜎 = 5.4

• Wie genau stimmen Parameter?

• Wie genau stimmt Vorhersage?

Page 5: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

t-Test in der Linearen Regression

1. Modell: 𝑌𝑖 = 𝛽0 + 𝛽1𝑥𝑖 + 𝐸𝑖 , 𝐸1, … , 𝐸𝑛 𝑖𝑖𝑑 𝑁(0, 𝜎2)

2. Nullhypothese: 𝐻0: 𝛽1 = 0Alternative: 𝐻𝐴: 𝛽1 ≠ 0 (es wird normalerweise ein zweiseitiger Test

durchgeführt)

3. Teststatistik:

𝑇 =𝑏𝑒𝑜𝑏𝑎𝑐ℎ𝑡𝑒𝑡 − 𝑒𝑟𝑤𝑎𝑟𝑡𝑒𝑡

𝑔𝑒𝑠𝑐ℎä𝑡𝑧𝑡𝑒𝑟 𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑𝑓𝑒ℎ𝑙𝑒𝑟= 𝛽1 − 0

𝑠. 𝑒. 𝛽1

Dabei ist 𝑠. 𝑒. 𝛽1 = 𝑉𝑎𝑟 𝛽1 der “Standard Error” von 𝛽1

Verteilung der Teststatistik unter 𝐻0: 𝑇~𝑡𝑛−24. Signifikanzniveau: 𝛼

5. Verwerfungsbereich der Teststatistik:

𝐾 = −∞,−𝑡𝑛−2;1−

𝛼2∪ 𝑡

𝑛−2;1−𝛼2, ∞

6. Testentscheid: Überprüfe, ob der beobachtete Wert der Teststatistik

im Verwerfungsbereich liegt.

Page 6: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Lineare Regression in R

5

Modell: 𝑌𝑖 = 𝛽0 + 𝛽1𝑥𝑖 + 𝐸𝑖 , 𝐸𝑖~𝑁 0, 𝜎2 𝑖. 𝑖. 𝑑

Modell: 𝑌𝑖 = −19.46 + 5.86𝑥𝑖 + 𝐸𝑖 , 𝐸𝑖~𝑁 0, 5.432 𝑖. 𝑖. 𝑑

P-Wert:

Angenommen 𝛽1 = 0;

wie wa. ist Beobachtung

oder etwas extremeres?

Beobachtete Teststatistik

im Test 𝐻0: 𝛽1 = 0 vs.

𝐻𝐴: 𝛽1 ≠ 0

Standardfehler von 𝛽1 (= 𝜎 𝛽1)

Approx. 95%-VI:

5.86 ± 2 ∗ 0.41

Exaktes 95%-VI:

Freiheitsgrade: n – (Anz. 𝛽’s) = 91 – 2 = 89

𝑡89;0.975

Page 7: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Bsp Prüfungsfrage

6

Kann 𝐻0: 𝛽1 = 0 auf dem 5%-Signifikanzniveau verworfen werden?

Page 8: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Bsp Prüfungsfrage

7

Kann 𝐻0: 𝛽1 = 0 auf dem 5%-Signifikanzniveau verworfen werden?

Ja:

- t value: 1.88/0.277 = 6.79

- Verwerfungsbereich:

−∞,−𝑡32;0.975 ∪ 𝑡32;0.975, ∞

𝑡32;0.975 = 2.037

Page 9: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P
Page 10: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

45

Page 11: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

approx. 95%-VI: [-29; -10]

approx. 95%-VI: [5.0; 6.7]

Page 12: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

45

95% Vertrauensintervall:[43.8; 46.2]

Für den Erwartungswert von

VO2max bei vmax=11

Page 13: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

45

95% Vorhersageintervall:[34; 56]

Für eine Einzelbeobachtung

von VO2max bei vmax=11

Page 14: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

“Essentially,

all models are

wrong,

but some are

useful.“

George E.P. Box

Page 15: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Residuenanalyse: Wie gut stimmt das Modell ?

14

𝑌𝑖 = 𝛽0 + 𝛽1𝑥𝑖 + 𝜀𝑖 ; 𝜀𝑖 ~ 𝑁 0, 𝜎2 𝑖𝑖𝑑

• Form des funktionellen Zusammenhangs

• Varianz der Fehler ist konstant

• Fehler sind normalverteilt

Einfache Regression:

Streudiagramm

Multiple Regression:

Tukey-Anscombe Plot

QQ-Plot der

Residuen

Page 16: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Streudiagramm bei einfacher linearer Regression

15

0.0 0.5 1.0 1.5 2.0 2.5 3.0

24

68

10

12

x

y OK

Page 17: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Streudiagramm bei einfacher linearer Regression

16

Systematischer Fehler

Krümmung:

𝑦 = 𝑏0 + 𝑏1𝑥 + 𝑏2𝑥2

0.0 0.5 1.0 1.5 2.0 2.5 3.0

05

10

15

20

25

30

x

y

Page 18: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Streudiagramm bei einfacher linearer Regression

17

Fehlervarianz

nicht konstant

0.0 0.5 1.0 1.5 2.0 2.5 3.0

01

02

03

0

x

y

Page 19: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Beispiel für guten Tukey-Anscombe Plot

18

Page 20: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Beispiele für schlechte Tukey-Anscombe Plots

19

Systematischer

FehlerFehlervarianz nicht konstant

Page 21: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Residuenanalyse: QQ-Plot

20

S-Form

Krümmung

OK

Gerade

Gerade = “gut”

Krümmung = “schlecht”

Page 22: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

QQ-Plots: Streuung von “guten” QQ-Plots

(𝒏 = 𝟑𝟎, 𝑹𝒊~𝑵 𝟎, 𝟏 )

21

Page 23: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Falls Residuenplots schlecht

Oft helfen Transformationen von x oder y

Achtung: Vorsicht beim Interpretieren der neuen Parameter

Bsp: log 𝑦 statt 𝑦

Vorher: 𝑌𝑖 = 𝛽0 + 𝛽1𝑥𝑖 + 𝜀𝑖Wenn x durch x+1 ersetzt wird, ändert sich 𝑌 im Mittel zu

𝑌 + 𝛽1

Nachher:

log 𝑌𝑖 = 𝛽0 + 𝛽1𝑥𝑖 + 𝜀𝑖 ↔ 𝑌𝑖 = exp(𝛽0 + 𝛽1𝑥𝑖 + 𝜀𝑖)Wenn x durch x+1 erstetzt wird, ändert sich 𝑌 “im Mittel” zu

𝑌 ∗ exp(𝛽1)

22

Page 24: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Bsp: Ohne Log-Transformation

23

OK

log 𝑦

𝑦

Page 25: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Residuenanalyse: Supermarkt

24

OKOK

Page 26: Lineare Regression: Tests - stat.ethz.ch · 12-Minuten Test nach Cooper (1968) ... von VO2max bei vmax=11 “Essentially, all models are wrong, but some are useful.“ George E.P

Residuenanalyse: Beep-Test

25

OKOK