30
6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a x i sind oft zufällig. Das ist o.k. -→ Bedingte Analyse, gegeben die x i . Anderes Problem: x mit Messfehlern. (Wahrer Wert nicht zufällig!) b „Latente" Variable u, v v = e α + e βu X i = u i + D i , Y i = v i + E i = e α + e βu i + E i D i ∼Nh02 D i , E i ∼Nh02 i unabhängig Wie gross sind e α, e β ?

6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 200

6 Ergänzungen

6.1 Fehlerbehaftete Eingangs-Variable

a xi sind oft zufällig. Das ist o.k. −→ Bedingte Analyse, gegeben die xi.

Anderes Problem: x mit Messfehlern. (Wahrer Wert nicht zufällig!)

b „Latente" Variable u, vv = α̃+ β̃u

Xi = ui+Di , Yi = vi+ Ei = α̃+ β̃ui+ EiDi ∼ N〈0, σ2D〉 , Ei ∼ N〈0, σ2〉 unabhängig

Wie gross sind α̃, β̃?

Page 2: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 201

c

Page 3: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 202

d errors-in-variables, functional and structural model

e Schätzung: Falls σ2D bekannt:

β̂ =

∑ni=1(Yi − Y )(xi − x)∑ni=1(xi − x)2 − σ2D

= β̂LS/κ̂

κ̂ =v̂ar〈X〉 − σ2D

v̂ar〈X〉

κ: (attenuation coefficient)

f α̂ = Y − β̂ X

Page 4: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 203

g Im Beispiel der Schadstoffe im Tunnel

0 5 10 15 20 25 30

010

0020

0030

0040

0050

0060

00

Lastwagen−Anteil (%)

Ef.N

Ox

ohne Korrekturmit Korrektur

Page 5: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 204

i Schätzung: Falls γ = σ/σD bekannt:

X „umskalieren", so dass γ = 1 ist

−→ orthog. Regression, zurückrechnen.

j Orthogonale Regression: Minimiere∑ni=1 d

2i 〈a, b〉.

Hauptkomponenten-Analyse.

- x

6

y

◦◦

◦����

����

����

����

����

����

����

����

����

�������

BBBB

di〈a, b〉[xi, yi] y = a+ bx

Page 6: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.1 Fehlerbehaftete Eingangs-Variable 205

k Man muss σ/σD oder σD kennen.

l Anwendung:

• Vorhersage: gewöhnliche Regression (Achtung!)

• Test für Einfluss (β = 0): gewöhnliche R.

• Schätzung von α̃, β̃ : errors-in-variables

Page 7: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.2 Eichung 206

6.2 Eichung

a Aus dem Resultat einer (billigen) Mess-Methode

das Resultat einer anderen (teuren) „schätzen".

Bestimmung des Zusammenhangs:

Exakte Werte vorgegeben: xi.

Anwendung der billigen Methode→ YiAnwendung: von Y0 auf x0 schliessen!

Inverse Regression, Calibration

b Schätzung: α̂, β̂ bestimmen −→ x̂ = (Y − α̂)/β̂

c Wie genau ist dieser Wert? – Vorhersage-Band

α̂ + β̂x0±b mit b = qtn−20.975 σ̂

√1+ 1

n + (x0 − x)2/SSQ(X)

Umkehrung: (y − α̂)/β̂ ± b/β̂

Page 8: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.2 Eichung 207

●●

●●

●●

●●

●●

● ●

●●●

●●

●●

●●

●●●

●●●

●●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

● ●

●●

●●

●●

●●

●●

●●●

●●

● ●●

●●●

●●●

●●●●

●●●

●●

●●●

●●

●●●

●●●●●●●●●●●

●●●●●●●

●●●●

●●

●●●

Wahrer Wert

Mes

sung

0 5 10 15 25 30x0

y0

05

1015

2025

Page 9: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.2 Eichung 208

6.2

d* Einige weitere Stichworte:

• Fehlerbehaftete x-Werte:

Man verwende eine Schätzung der „wahren Geraden" α̃+ β̃ x.

• Überprüfung der Linearität und anderer Modell-Annahmen!

• Periodische Kalibrierung:

sollte nicht mit Einzelmessungen erfolgen.

Page 10: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.2 Eichung 209

6.2

e* Zusammenhang von Eichproblem und fehlerbehafteten x:

„Naives" Vorgehen beim Eichproblem:

Da man die x-Werte aus Y „vorhersagen" will,

vertauscht man die Rollen

Aber: Dann ist die falsche Variable mit Messfehlern behaftet.

Errors-in-variables-Modell liefert richtige Gerade mit σ/σD = 0.

Aber: Bei Vorhersage war doch Kl.-Quadrate-Schätzung richtig. ???

Nur, wenn für eine neue Beobachtung die bedingte Vert. der Zielgrösse,

geg. die Ausgangsgrösse, gleich ist wie bei den „Trainings-Daten"!

Page 11: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

6.2 Eichung 210

Merkpunkte Regression 1 - Ergänzungen

1. Fehlerbehaftete x-Variable:

Wenn Koeffzienten geschätzt werden sollen, muss man korrigieren!

Kleinste Quadrate geben zu flache Gerade.

2. Eich-Problem = inverse Regression

Aufgepasst mit der Festlegung von x und Y !

Page 12: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 211

7 Summary of Regression Models

7.1 Ordinary linear regression: Models, inference

a Model Yi = β0 + β1x(1)i + β2x

(2)i + . . .+ βmx

(m)i + Ei

Ei ∼ N〈0, σ2〉Parameters: β0, β1, β2, . . . , βm, σ2.

Page 13: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 212

b Simple regression

1.6 1.8 2.0

01

x

Y proba− bility density

y = 4 − 2 x

Page 14: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 213

c Estimation

●●

40 50 60 70 80 90 100 110 120

12

510

distance

trem

or

[xi, yi]ri

Least Squares: Minimize the Sum of Squared “Residuals” ri,∑n

i=1r2i , ri = yi − (α+ βxi)

Page 15: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 214

d Estimated line is random

01

1.6 1.8 2.0

01 ●

1.6 1.8 2.0

Page 16: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 215

e Tests and confidence intervals for coefficients

Coefficients:

Value Std. Error t value Pr(> |t|) Signif

(Intercept) 2.51044 0.28215 8.90 0.000 ***

log10(dist) -1.33779 0.14073 -9.51 0.000 ***

log10(loading) 0.69179 0.29666 2.33 0.025 *

location2 0.16430 0.07494 2.19 0.034 *

location3 0.02170 0.06366 0.34 0.735

location4 0.11080 0.07477 1.48 0.146

Residual standard error: 0.1468 on 42 degrees of freedom

Multiple R-Squared: 0.8322

F-statistic: 41.66 on 5 and 42 degrees of freedom, p-value 3.22e-15

Where is the coefficient for location 1?

Confidence interval: β̂j ± q(0.975)tn−m′

se(βj)

Page 17: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.1 Ordinary linear regression: Models, inference 216

f Confidence and prediction band

●●

distance

trem

or

40 50 60 70 80 90 100 110 120

12

35

10

prediction bandconfidence band

Page 18: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.2 The Flexibility of the Model 217

7.2 The Flexibility of the Model

• Use transformations of Y and X to make the relation linear

• binary X(j)

• factor ( −→ coefficient for 1 level missing! )

• factor and continuous variable: parallel lines

• interaction: non parallel lines

effect of one X(j) depends on the value of the other.

• quadratic, cubic, ... polynomial regression function

Page 19: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.2 The Flexibility of the Model 218

Collinearity

• complicates the interpretation of coefficients

• has nothing to do with interaction

• can be avoided by re-defining explanatory variables

in a sensible way (so that they remain interpretable)

Page 20: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.3 Residual analysis 219

7.3 Residual analysis

a Examine assumption in order to improve the model by

– transformations

– weighted regression (and generalized LS)

– additional terms

Page 21: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.3 Residual analysis 220

b Tukey-Anscombe plot (“tiuki”): Residual vs. fitted, to find

– non-linearity

– unequal σ

– skewed distribution and/or outliers ( −→ normal plot)

Fitted Values

res(

RU

T )

0 5 10 15

−4

02

46 10 13

15

RUT~VISC + ASPH + BASE + RUN + FINES + VOIDS

Feb

10,

01/7

:31

| |

Fitted Values

|st.s

m.r

es(

RU

T )

|

0 5 10 15

0.5

1.0

1.5

10

13

15

Feb

10,

01/7

:31

| |

−2 −1 0 1 2

−2

01

23

Theoretical Quantiles

st.s

m.r

es(

RU

T )

15

10 13

Feb

10,

01/7

:31

| |

leverages

st.s

m.r

es(

RU

T )

0.1 0.2 0.3 0.4 0.5

−1.

50.

01.

010

13

15

26

Feb

10,

01/7

:31

| |

Page 22: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.3 Residual analysis 221

c Residuals vs. explanatory variables: find

– non-linearity

– unequal σ

dist

Resid

uals

40 60 80 100 120 140 160 180

−0.3

−0.2

−0.1

0.0

0.1

0.2

Oct

1,0

1/2

:19

|

|

log10(ersch) ~ Stelle + log10(dist) + log10(ladung)

Oct

1,0

1/2

:19

|

|

ladung

Resid

uals

2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6−

0.3

−0.2

−0.1

0.0

0.1

0.2

Oct

1,0

1/2

:19

|

| O

ct

1,0

1/2

:19

|

|

Page 23: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 222

7.4 Model development

• Use residual analysis to find appropriate transformations

• Test for squared terms and interactions

• Automatic model selection: stepwise, all subsets, lasso

• Use the knowledge of the field of application!

• Strategy needed for not getting lost.

Page 24: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 223

Merkpunkte Einfache Regression

1. Regression ist die am meisten verbreitete Methodik der Statistik

2. Die einfache lineare Regression ist eine einfache Anwendung

des Grundschemas:

• Modell: Yi = α+βxi+Ei, Ei ∼ N〈0, σ2〉, unabhängig

• Schätzung: Maximum likelihood führt auf Kleinste Quadrate

• Test: Schätzung als Teststatistik, standardis, mit gesch. Streuung

−→ t-Test

• Vertrauensintervall: aus dem t-Test

Page 25: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 224

Merkpunkte Vertrauens- und Prognoseband

1. „Vertrauens-Band":

Wo liegt der wahre Funktionswert für gegebenes x?

2. Vorhersage, Prognose:

„Schätzung" einer Zufallsvariablen. Ergibt „Vorhersage-Band":

Wo liegt eine neue Beobachtung für gegebenes x?

Page 26: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 225

Merkpunkte Multiple Regression

1. Die multiple lineare Regression bildet ein reichhaltiges Modell

mit vielen Anwendungen.

2. Mit Transformationen, quadrat. Termen, Wechselwirkungen

kann man nicht-lineare Beziehungen der Variablen modellieren!

3. Multiple Regression führt zu einer viel aussagekräftigeren Analyse

als viele einfache Regressionen.

4. Mit Regression allein kann keine Ursache – Wirkungsbeziehungen

beweisen.

Page 27: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 226

Merkpunkte Residuen-Analyse

1. Im Tukey-Anscombe-Diagramm sieht man Abweichungen von

• der angenommenen Regressionsfunktion,

• der Gleichheit der Varianzen (Scale Plot)

• der Form der Verteilung der Fehler (genauer: QQ-Plot)

Transformation der Zielgrösse hilft oft.

2. Residuen gegen Eingangs-Variable −→ Transformation der E.-V.

Wechselwirkungen

3. Einflussreiche Beobachtungen

4. Residuenanalyse dient der Verbesserung eines Regressionsmodells.

Regression ohne Residuenanalyse ist „unzulässig"!

Page 28: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 227

Merkpunkte Modell-Entwicklung

1. Automatisierte Verfahren zur Variablenwahl sind ein

nützliches Hilfsmittel, finden aber nicht „die Wahrheit"

2. Modellwahl ist ein Zusammenspiel von

• Vorwissen aus Anwendung und Statistik,

• Residuen-Analyse, „Detektivarbeit",

• automatischen Modellwahl-Methoden,

• Residuen-Analyse, „Detektivarbeit",

• Prinzip der Einfachheit,

• Beurteilung der Plausibilität vom Fachwissen her.

Page 29: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 228

Merkpunkte Modell-Entwicklung, Fortsetzung

1. Kollinearität verletzt Modellannahmen nicht,

führt aber zu Schwierigkeiten der Interpretation

– indirekte Effekte

– grosse Standardfehler

– 2 korrelierte Variable: eine Variable weglassen

(welche, macht oft wenig Unterschied), aber nicht beide

2. Orthogonalität vermeidet das Problem.

−→ bei geplanten Versuchen kann man das einrichten.

3. Nicht verwechseln mit Wechselwirkung!

Page 30: 6.1 Fehlerbehaftete Eingangs-Variable - ETH Z · 6.1 Fehlerbehaftete Eingangs-Variable 200 6 Ergänzungen 6.1 Fehlerbehaftete Eingangs-Variable a xisind oft zufällig.Das ist o.k.!

7.4 Model development 229

Merkpunkte Regression: Ergänzungen

1. Fehlerbehaftete x-Variable:

Wenn Koeffzienten geschätzt werden sollen, muss man korrigieren!

Kleinste Quadrate geben zu flache Gerade.

2. Eich-Problem = inverse Regression

Aufgepasst mit der Festlegung von x und Y !