Professional Documents
Culture Documents
00 Main Pt1to6
00 Main Pt1to6
Fabian Scheipl
Institut für Statistik
Ludwig-Maximilians-Universität München
2 / 327
Introduction
Summary
Introduction
Overview
From high-dimensional to functional data
Summary
4 / 327
Introduction
Overview
Examples of functional data: Berkeley growth study
200
160
Height
120 80
5 10 15
Age
4 / 327
Introduction
Overview
Examples of functional data: Handwriting
0.03
−0.03 −0.01 0.01
y(t)
5 / 327
Introduction
Overview
Examples of functional data: Brain scan images
6 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
Characteristics of functional data:
200
0.03
160
y(t)
120 80
I Several measurements for the same statistical unit, often over time
I Sampling grid is not necessarily equally spaced, sparse data
I Smooth variation, that could be assessed (in principle) as often as
desired
I Noisy observations
I Many observations of the same data generating process
↔ time series analysis
J. Ramsay and Silverman 2005
7 / 327
Introduction
Overview
● ●
4
4
● ●
● ●
● ●
● ●
● ●
● ●
● ●
● ●
● ●
●● ● ●● ●● ● ●●
● ● ● ● ● ●
● ● ● ●
● ●
● ● ● ● ● ●
2
2
●● ● ● ●● ● ●
● ●
● ●
x(t)
x(t)
● ● ● ●
● ●
● ● ● ● ● ●
● ●
● ● ● ● ● ●
● ●● ● ●●
● ●
●● ● ● ● ●● ● ● ●
● ● ● ●
●● ● ● ● ● ●● ● ● ● ●
● ● ● ●● ● ● ● ●●
0
0
● ● ● ●
● ● ● ● ● ● ● ●
● ●● ● ● ● ● ●● ● ● ●
● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ●● ● ● ●● ●
● ● ● ●
● ● ● ●
● ● ● ●
● ●
−2
−2
●● ●●
● ●
● ●
●● ● ●● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
t t
8 / 327
Introduction
Overview
1.5
0.03
0.03
1.0
1.0
0.5
0.5
y(t)
x
x
−0.5
−0.5
−1.5
−1.5
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 −0.03 −0.01 0.01 0.03 −0.03 −0.01 0.01 0.03
t t x(t) x(t)
8 / 327
Introduction
Overview
200
200
200
160
160
160
160
Height
Height
Height
Height
120
120
120
120
80
80
80
80
5 10 15 5 10 15 5 10 15 5 10 15
Age Age Age Age
J. Ramsay and Silverman 2005
8 / 327
Introduction
Overview
Z
Scalar-on-Function: yi = µ + xi (s)β(s)ds + ε
8 / 327
Outline
Introduction
Overview
From high-dimensional to functional data
Summary
9 / 327
Introduction
From high-dimensional to functional data
...
n observations
...
...
...
p variables
9 / 327
Introduction
From high-dimensional to functional data
...
n observations
...
...
...
p variables
9 / 327
Introduction
From high-dimensional to functional data
...
n observations
...
...
...
p variables
9 / 327
Introduction
From high-dimensional to functional data
Data with natural ordering:
t1 t2 t3 ... tp
t1 t2 t3 tp
I Longitudinal data
I Ordering along time domain (one-dimensional)
Functional data:
t1 t2 t3 ... tp
T
t1 t2 t3 ... tp
t1 t2 t3 tp
I Longitudinal data
I Ordering along time domain (one-dimensional)
Functional data:
t1 t2 t3 ... tp
T
t1 t2 t3 ... tp
t1 t2 t3 tp
I Longitudinal data
I Ordering along time domain (one-dimensional)
Functional data:
t1 t2 t3 ... tp
T
t1 t2 t3 ... tp
t1 t2 t3 tp
I Longitudinal data
I Ordering along time domain (one-dimensional)
Functional data:
t1 t2 t3 ... tp
T
11 / 327
Introduction
From high-dimensional to functional data
Functional data:
11 / 327
Introduction
From high-dimensional to functional data
Functional data:
11 / 327
Introduction
Summary
12 / 327
Descriptive Statistics for Functional Data
Pointwise measures
Example: Growth curves of 54 girls
80
5 10 15
age (years)
Summary Statistics:
I Based on observed functions x1 (t), . . . , xn (t)
I Characterize location, variability, dependence between time points, ...
12 / 327
Descriptive Statistics for Functional Data
Pointwise measures
Example: Growth curves of 54 girls
80
5 10 15
age (years)
Summary Statistics:
I Based on observed functions x1 (t), . . . , xn (t)
I Characterize location, variability, dependence between time points, ...
12 / 327
Descriptive Statistics for Functional Data
Pointwise measures
Example: Growth curves of 54 girls
80
5 10 15
age (years)
Summary Statistics:
I Based on observed functions x1 (t), . . . , xn (t)
I Characterize location, variability, dependence between time points, ...
12 / 327
Descriptive Statistics for Functional Data
Pointwise measures
Example: Growth curves of 54 girls
100 120 140 160 180
20
10
height (cm)
0
−10
80
−20
5 10 15 5 10 15
20
10
height (cm)
0
−10
80
−20
5 10 15 5 10 15
20
10
height (cm)
0
−10
80
−20
5 10 15 5 10 15
7
height (cm^2)
40
6
height (cm)
30
5
20
4
10
3
5 10 15 5 10 15
14 / 327
Descriptive Statistics for Functional Data
Pointwise measures
Example: Growth curves of 54 girls
50
7
height (cm^2)
40
6
height (cm)
30
5
20
4
10
3
5 10 15 5 10 15
14 / 327
Outline
Introduction
Summary
15 / 327
Descriptive Statistics for Functional Data
Covariance and Correlation Functions
v̂X (s, t)
ĉX (s, t) = q
σ̂X2 (s)σ̂X2 (t)
15 / 327
Descriptive Statistics for Functional Data
Covariance and Correlation Functions
v̂X (s, t)
ĉX (s, t) = q
σ̂X2 (s)σ̂X2 (t)
15 / 327
Descriptive Statistics for Functional Data
Covariance and Correlation Functions
v̂X (s, t)
ĉX (s, t) = q
σ̂X2 (s)σ̂X2 (t)
15 / 327
Descriptive Statistics for Functional Data
Covariance and Correlation Functions
40
50
15
heigh
40
40
40 45
55
30
age (years)
t
(cm^2
50 35
10
20
10
)
30
15 25
ag
15)
5
20
s
e
10
10 ear
(y
15
y
ea
5 (
5 age
rs
10
)
5 10 15
age (years)
16 / 327
Descriptive Statistics for Functional Data
Covariance and Correlation Functions
1.0
auto−
0.55
0.75
0.9
0.6
15
0.8
0.75
correla
0.8 0.8
age (years)
0.7 0.75
10
tion
0.6
0.65
0.85
15
ag
5
15) 0.9
5
s
e
10
10 ear
0.7
(y
0.9
y 0.95
ea
0.8
0.9
5 ( 0.85
5 age
rs
5 10 15
age (years)
17 / 327
Introduction
Summary
18 / 327
Basis Representation of Functional Data
Regularly and irregularly sampled functional data
2
.. ..
. .
1 tp xi (tp )
0
0 20 40
t
18 / 327
Basis Representation of Functional Data
Regularly and irregularly sampled functional data
2
.. ..
. .
1 tp xi (tp )
0
0 20 40
t
18 / 327
Basis Representation of Functional Data
Regularly and irregularly sampled functional data
Example bacterial growth curve Sample of curves x1 (t), . . . , xN (t)
5 Observed measurements
4 in ’wide format’:
t1 x1 (t1 ) x2 (t1 ) . . . xN (t1 )
3
.. .. ..
. . .
y
2
.. .. ..
. . .
1
tp x1 (tp ) x2 (tp ) . . . xN (tp )
0
0 20 40
t
2
.. .. ..
. . .
1
tp x1 (tp ) x2 (tp ) . . . xN (tp )
0
0 20 40
t
2
.. .. ..
. . .
1
tp x1 (tp ) x2 (tp ) . . . xN (tp )
0
0 20 40
t
2
t1,p1 x1 (t1,p1 )
1 .. ..
. .
0
tN,1 xN (tN,1 )
0 20 40
.. ..
t
. .
⇒ Irregular functional data: tN,pN xN (tN,pN )
I functions observed on different time points
I sometimes only sparsely sampled
I more difficult, but often given in practice
20 / 327
Basis Representation of Functional Data
Regularly and irregularly sampled functional data
2
t1,p1 x1 (t1,p1 )
1 .. ..
. .
0
tN,1 xN (tN,1 )
0 20 40
.. ..
t
. .
⇒ Irregular functional data: tN,pN xN (tN,pN )
I functions observed on different time points
I sometimes only sparsely sampled
I more difficult, but often given in practice
20 / 327
Basis Representation of Functional Data
Regularly and irregularly sampled functional data
2
t1,p1 x1 (t1,p1 )
1 .. ..
. .
0
tN,1 xN (tN,1 )
0 20 40
.. ..
t
. .
⇒ Irregular functional data: tN,pN xN (tN,pN )
I functions observed on different time points
I sometimes only sparsely sampled
I more difficult, but often given in practice
20 / 327
Outline
Introduction
Summary
21 / 327
Basis Representation of Functional Data
Basis functions
2
k=1
21 / 327
Basis Representation of Functional Data
Basis functions
2 .. ..
. .
1
K θK
0
0 20 40
t
Function given by
K
X
f (t) = θk bk (t)
k=1
22 / 327
Basis Representation of Functional Data
Basis functions
2 .. ..
. .
1
K 1
0
0 20 40
t
Function given by
K
X
f (t) = θk bk (t)
k=1
22 / 327
Basis Representation of Functional Data
Basis functions
2 .. ..
. .
1
K 1
0
0 20 40
t
Function given by
K
X
f (t) = θk bk (t)
k=1
22 / 327
Basis Representation of Functional Data
Basis functions
2 .. ..
. .
1
K K
0
0 20 40
t
Function given by
K
X
f (t) = θk bk (t)
k=1
22 / 327
Outline
Introduction
Summary
23 / 327
Basis Representation of Functional Data
Basis representations for functional data
Basis representation Approximate data with basis functions
4
θ i k bk ( t ) ⇒ seek to specify θ̂i,1 , . . . , θ̂i,K such
f ( t ) = Σ k θ i k bi k ( t ) that
3 K
X
xi (t) ≈ θ̂i,k bk (t) .
2
y
k=1
0
0 20 40
t
⇒ Popular criterion:
Specify θ̂i,1 , . . . , θ̂i,K such that quadratic distance becomes minimal,
i.e. !2
X q K
X
xi (tj ) − θi,k bk (tj ) −→ min
θi,k
j=1 k=1
23 / 327
Basis Representation of Functional Data
Basis representations for functional data
Basis representation Approximate data with basis functions
4
θ i k bk ( t ) ⇒ seek to specify θ̂i,1 , . . . , θ̂i,K such
f ( t ) = Σ k θ i k bi k ( t ) that
3 K
X
xi (t) ≈ θ̂i,k bk (t) .
2
y
k=1
0
0 20 40
t
⇒ Popular criterion:
Specify θ̂i,1 , . . . , θ̂i,K such that quadratic distance becomes minimal,
i.e. !2
X q K
X
xi (tj ) − θi,k bk (tj ) −→ min
θi,k
j=1 k=1
23 / 327
Basis Representation of Functional Data
Basis representations for functional data
2 .. .. ..
. . .
K θ̂1,K θ̂2,K . . . θ̂N,K
0
0 20 40 PK
t
Functional observations represented as xi (t) ≈ k=1 θ̂i,k bk (t).
24 / 327
Outline
Introduction
Summary
25 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
1
0
I cheap to compute & numerically
B-Spline of degree 3 stable
4
3 I local support: sparse matrix of basis
2
1
function evaluations
0
0 20 40
t
25 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
1
0
I cheap to compute & numerically
B-Spline of degree 3 stable
4
3 I local support: sparse matrix of basis
2
1
function evaluations
0
0 20 40
t
25 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
1
0
I cheap to compute & numerically
B-Spline of degree 3 stable
4
3 I local support: sparse matrix of basis
2
1
function evaluations
0
0 20 40
t
25 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
1
0
I cheap to compute & numerically
B-Spline of degree 3 stable
4
3 I local support: sparse matrix of basis
2
1
function evaluations
0
0 20 40
t
25 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
26 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
26 / 327
Basis Representation of Functional Data
Most popular choices of basis functions
26 / 327
Outline
Introduction
Summary
27 / 327
Basis Representation of Functional Data
Smoothness and regularization
0
0 20 40
t
27 / 327
Basis Representation of Functional Data
Smoothness and regularization
Penalization:
I minimize quadratic difference from data
+ a roughness penalty term
Specify θ̂i,1 , . . . , θ̂i,K to minimize
p K
!2
X X
xi (tj ) − θi,k bk (tj ) + λ pen(θi ) −→ min
θi,k
j=1 k=1
I with, e.g., P
quadratic penalty on second order differences, i.e.
pen(θi ) = K 2
k=3 ((θi,k − θi,k−1 ) − (θi,k−1 − θi,k−2 )) and λ > 0 a
smoothing parameter
28 / 327
Basis Representation of Functional Data
Smoothness and regularization
Penalization:
I minimize quadratic difference from data
+ a roughness penalty term
Specify θ̂i,1 , . . . , θ̂i,K to minimize
p K
!2
X X
xi (tj ) − θi,k bk (tj ) + λ pen(θi ) −→ min
θi,k
j=1 k=1
I with, e.g., P
quadratic penalty on second order differences, i.e.
pen(θi ) = K 2
k=3 ((θi,k − θi,k−1 ) − (θi,k−1 − θi,k−2 )) and λ > 0 a
smoothing parameter
28 / 327
Basis Representation of Functional Data
Smoothness and regularization
Penalization:
I minimize quadratic difference from data
+ a roughness penalty term
Specify θ̂i,1 , . . . , θ̂i,K to minimize
p K
!2
X X
xi (tj ) − θi,k bk (tj ) + λ pen(θi ) −→ min
θi,k
j=1 k=1
I with, e.g., P
quadratic penalty on second order differences, i.e.
pen(θi ) = K 2
k=3 ((θi,k − θi,k−1 ) − (θi,k−1 − θi,k−2 )) and λ > 0 a
smoothing parameter
28 / 327
Basis Representation of Functional Data
Smoothness and regularization
Fit with λ = 0 Fit with λ = 1
4 4
3 3
2 2
y
y
1 1
0 0
-1 -1
0 20 40 0 20 40
t t
1
0
-1
0 20 40
t
29 / 327
Basis Representation of Functional Data
Smoothness and regularization
Fit with λ = 0 Fit with λ = 1
4 4
3 3
2 2
y
y
1 1
0 0
-1 -1
0 20 40 0 20 40
t t
1
0
-1
0 20 40
t
29 / 327
Outline
Introduction
Summary
30 / 327
Basis Representation of Functional Data
Other representations of functional data
30 / 327
Basis Representation of Functional Data
Other representations of functional data
30 / 327
Basis Representation of Functional Data
Other representations of functional data
30 / 327
Introduction
Summary
31 / 327
Summary
Functional Data:
I Arises in many different contexts and in many applications (curves,
images,...)
I Observation unit represents the full curve, typically discretized, i.e.
observed on a grid
I Important analysis techniques:
I Smoothing and basis representation
I Functional principal component analysis
I Functional regression
Summary Statistics:
I Give insights into location, variability and time dependence in a
sample of curves
I Pointwise calculation, mostly analogous to multivariate case
31 / 327
Summary
Basis representation:
I Different types of raw functional data: regularly and irregularly
sampled
I (Approximate) representation via bases of functions
I ’true functional representation’
I smoothing / vector representation
I Represent a functional datum in terms of a global, fixed, known
dictionary of basis functions and an observation-specific coefficient
vector.
I Different types of basis functions for different purposes
I Obtaining desired ’smoothness’ via penalization
32 / 327
Part II
Background: Regression
33 / 327
Recap: Linear Models
35 / 327
Data & Model
Data:
I (yi , xi1 , . . . , xik ); i = 1, . . . , n
I metric target variable y
I metric or categorical covariates x1 , . . . , xp (categorical data in binary
coding)
Model:
I yi = β0 + β1 xi1 + · · · + βp xip + εi ; i = 1, . . . , n
⇒ y = Xβ + ε; X = [1, x1 , . . . , xp ]
I i. i. d. residuals/errors εi ∼ N(0, σ 2 ); i = 1, . . . , n
I estimates ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
35 / 327
Data & Model
Data:
I (yi , xi1 , . . . , xik ); i = 1, . . . , n
I metric target variable y
I metric or categorical covariates x1 , . . . , xp (categorical data in binary
coding)
Model:
I yi = β0 + β1 xi1 + · · · + βp xip + εi ; i = 1, . . . , n
⇒ y = Xβ + ε; X = [1, x1 , . . . , xp ]
I i. i. d. residuals/errors εi ∼ N(0, σ 2 ); i = 1, . . . , n
I estimates ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
35 / 327
Data & Model
Data:
I (yi , xi1 , . . . , xik ); i = 1, . . . , n
I metric target variable y
I metric or categorical covariates x1 , . . . , xp (categorical data in binary
coding)
Model:
I yi = β0 + β1 xi1 + · · · + βp xip + εi ; i = 1, . . . , n
⇒ y = Xβ + ε; X = [1, x1 , . . . , xp ]
I i. i. d. residuals/errors εi ∼ N(0, σ 2 ); i = 1, . . . , n
I estimates ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
35 / 327
Interpreting the coefficients
Intercept:
β̂0 : estimate for y if all metric x = 0.
and all categorical x in their reference category.
metric covariates:
β̂m : estimated expected change in y if xm increases by 1 (ceteris
paribus).
categorical covariates: (dummy-/one-hot-encoding)
β̂mc : estimated expected difference in y between observations in
category c and the reference category of xm (ceteris paribus).
36 / 327
Outline
37 / 327
Linear Model Estimation
37 / 327
Properties of β̂
I unbiased: E(β̂) = β
I Cov(β̂) = σ 2 (X> X)−1
for Gaussian ε:
β̂ ∼ N(β, σ 2 (X> X)−1 )
38 / 327
Tests
Possible settings:
1. Testing for significance of a single coefficient:
H0 : βj = 0 vs HA : βj 6= 0
2. Testing for significance of a subvector βt = (βt1 , . . . , βtr )> :
H0 : βt = 0 vs HA : βt 6= 0
3. Testing for equality: H0 : βj − βr = 0 vs HA : βj − βr 6= 0
General:
Testing linear hypotheses H0 : Cβ = d
39 / 327
Tests
F-Test:
Compare sum of squared errors (SSE) of full model with SSE under
restriction H0 :
n − p SSEH0 − SSE
F =
r SSE
−1
(Cβ̂ − d) σ̂ 2 C(X> X)−1 C>
> (Cβ̂ − d) H0
= ∼ F (r , n − p)
r
t-Test:
Test significance of a single coefficient:
β̂j H0
t=q ∼ t(n − p)
\
Var(β̂j )
2
2 β̂j H0
F =t = ∼ F (1, n − p)
\
Var( β̂ ) j
40 / 327
Outline
41 / 327
Residuals in the linear model
41 / 327
Types of Residuals
42 / 327
Graphical model checks:
43 / 327
Outline
44 / 327
Linear Model in R:
44 / 327
Example: Munich Rents 1999
45 / 327
Model in R
no interaction:
y = β0 + β1 ∗ x1 + β2 ∗ x2.2 + β3 ∗ x2.3
miet1 <- lm(rentsqm ~ size + area)
(beta.miet1 <- coef(miet1))
with interaction:
y = β0 + β1 ∗ x1 + β2 ∗ x2.2 + β3 ∗ x2.3 + β4 x1 x2.2 + β5 x1 x2.3
miet2 <- lm(rentsqm ~ size * area)
(beta.miet2 <- coef(miet2))
miet1 miet2
35
35
area
● normal
● good
30
30
● best
25
25
net rent (DM/sqm)
20
15
15
10
10
5
5
0
round(anova(miet2), 3)
anova(miet1, miet2)
Standardized residuals
20
● ●
4
● ●
● ●
● ●
● ● ● ● ●
●● ● ●●●●
● ●
Residuals
● ● ●●●●
● ● ● ●
10
● ●
●
● ● ● ● ● ● ● ● ●● ● ●
●●
●●
●●
●
● ● ● ●● ● ● ● ● ● ● ● ● ● ●
●●
●
●●
●
●●
●
●
● ● ● ● ●●● ● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ●● ●
●● ●●
●●
●
●
●●
●
●
●●
● ●●● ●●●● ●●● ●●● ● ●● ● ● ●
2
● ● ● ● ● ●● ● ● ●
●
●●
●●
●
●●
●●
● ●●● ● ●● ● ● ● ● ●● ● ● ●● ●●
●
●●
●
● ●● ●● ● ● ● ● ● ●●
●● ●●● ●●● ●● ● ● ● ● ●
●●●
●●● ●
● ● ●● ● ●● ●
●●
●
●
●●
●
●
● ● ●● ●●
● ● ●●
● ●●●●● ● ● ●● ● ●● ● ● ●●
●● ● ●
●●●● ●●●●●●●● ●●
● ● ●●●
● ● ● ●●●● ●
●
●●●●
●
●●
●●● ● ●
●
●●
●
●
●●
●
●●
●
●
●●
●
●●
● ● ● ● ● ● ●● ● ● ● ●● ● ● ●
● ● ●●● ●
●●● ● ● ●● ● ●●
●
●
●
● ●
●● ● ●● ● ●● ● ●●● ● ●● ●●● ● ●● ● ● ●●●
●●●
●●●● ●●●● ●● ●●
●●●●●●●●●●
●●●●●●●● ● ●
● ●●●● ● ● ●●
●●
●●●●●● ● ●
●
●
●●
●
●
●●
●
●
●●
●
●
● ●● ●●● ●
● ●●● ●●●●● ●● ●● ●● ●●●● ●●●
● ●● ●●●
● ●● ●●●●
●● ●●
● ●● ●● ● ●● ●
●●
●
●
●●
●
●
●●
●
●
● ●● ● ●●●● ●● ● ● ●●● ●● ● ●
● ●
●●
●●
●●●● ●●
● ●●
● ●●
●
●● ●
●●●● ●●
●
●●● ● ●
●●● ●
●●●
● ●● ●
●● ● ●
●
●●
●
●
●●
●
● ●● ● ● ●● ●●
● ●●● ●●
●●
●
●●●●
●●
● ●●● ●●●●●
●● ●
●●● ●●
●●● ● ●●●●●● ●●● ●●●●●●
●
● ●●●●●● ● ●
●●
●
●
●●
●
●
●●
● ●●● ● ● ●● ● ● ● ● ●● ●●
●●●
● ●●
●●●
●
●
●
●●●
●●●●●
●●●●
● ●●●●●●●
●●●
● ●●●●● ●
●●●
●●●●●
●
●
●● ●●
●●
●
●
●●●●
● ●●
●●●●
●●
●
● ●●●●
● ●●●●●● ●
●
● ●
●● ●●
● ● ●●
●● ●●
●●
● ●
●
●●
● ●● ● ● ●
●●● ●
●●
●
●
●●
●●
●
●
●●
●
● ●
●
●
●
●●●
●
● ● ● ● ●●
●● ● ● ● ● ●●●●●●●●●●● ●●
●●● ●●● ●
●● ●●
●
●● ● ●●●
●● ●
●
●● ●
●●●
● ●●
● ●
●
●●●●
●●●●●
● ●●● ●●
●●● ●
●●● ●●●● ●● ●●●●
●●● ●
●●●●●● ●●●● ● ● ●
●●
●
●
●●
●
●
●●
●
●● ●●●●●● ● ●●●
●●●●● ●●●●
●●
●● ● ●●●●●●
●●●●● ●● ●●
●●●●
● ●●
● ●
●●●●●●● ●
●●● ● ●
●
●●
●
●
●
●●
● ●
●
● ●● ● ● ● ● ●●
●
●
●
●● ●
●● ●●
● ●
●● ●
● ●●
●
●●
●● ●● ●
●
●●
● ●●
●●●
●●
●
●
●
●
●
● ●
●●●
● ●●
●●●●
●
●
●
●
●
●
●
●
●
●
● ●●●
●●●●●
●
●
●●
●
●
●
●
●●
●●●●
●
●
●
● ●
●●●
●
●
●●●
●
●●
●
● ● ● ●●● ●
●●
●●
●
●
●
●
●
●●●
●
●●
●●
●●●● ● ●
●●
●
●●
●
●●
●
●
●
●●
● ●
●
●
●●
●
●
●
● ●●● ● ● ● ●●● ● ●●● ●
●●●●● ●●●●
● ●
●●● ●●●●● ●●
●●●
●● ●●
●● ●● ●●●
●● ●●●
●●●●
●● ●● ●●
● ●●● ● ●
●●
●
● ●● ● ● ● ●● ●● ●●●● ●●●● ●●●●
● ●
0
●● ●● ●●
● ●●●● ●● ●● ●
● ● ● ● ● ● ● ● ● ●● ● ● ● ●●
● ●● ●● ●●● ●● ●● ●●●● ●●
●
●● ● ●●
●
● ●●
●●
●
●●
●●
● ●●● ●
●●
●●● ●●
●● ●●
●
●●
●●
●●
●●●
●
●
●●● ●●●●●●
●
●
●● ●●
●● ●●●●●●● ● ●●
●● ●●●●
●●
●
●● ● ●●●● ●
●●
●
●
●●
●
●
●●
●
●
●
● ● ● ●● ●● ● ●●● ●●
●
●● ● ●● ●● ●● ●
●●●
●● ● ●●
●● ●●
●
●●●●
● ●●●●●
●● ●●
●
●●●●●●●
●● ●●●
●●
●●●
●
●●
●●
●
●
●
●
●●
● ●●
●
●
●
●● ●●
●●
● ●
●●●●
●●●●● ● ● ●
●
●
●●●●
●● ●●● ● ● ●●
●
●
●●
●
●
●●
●
●
●●
●
0
● ●●●●●
●● ●●
●● ●
● ●● ●● ● ●● ● ●
●
●
● ● ● ●● ● ● ●●●
●●● ●● ●● ● ●●
●●●●●● ●●
●●
●●● ●●●●●●●●●●●
●● ●●
●●●●●●●
● ●●
●●●●●
●●●●
● ●●●
●
●●
●●● ●
● ●●
●●●●●●
●
●●● ●●
●
●● ●●●●●●●
●● ●●
● ● ●●● ●● ●
●
●●
●
●
●●
● ●
●
●
●●
●
●
●
● ●● ● ●
●● ● ●
●● ●●●
● ●●●
●● ●
●
●●●●
● ●●
●● ●
●●●●● ●
●
● ●●
●●
●●
● ●
●
●●●●●
● ●●
●●●
●●
● ●●●
● ●● ●●● ●● ●
●●●●●●● ● ●● ●●
●
●
●●
●
●
●●
● ●● ●● ●● ● ●●●●●
● ● ● ●
●●
●●●●●
● ●
●●●● ●●
●●●●
●●
●●●●●
●● ●●
●
●●
●●●●
●● ●●
●●●
● ●●●
●●
●●
● ●●
●
●
●●● ●
●●●●●●
●
● ●●●●●
●●
● ●●
●
●●
●●● ● ●● ● ●● ● ●●●
●● ●
●
●
●●
●
●
●●
●
●
● ● ● ●● ● ● ● ●●
●●● ●●
● ●●
●●
●●●
●●●● ● ●● ●●
● ●
●● ●
●●
●●●
●●
●●
● ● ●●
●●
●●●
●●
●●●●
●●
●
● ●●●●●●●●
●●● ● ●
●●● ●● ●● ● ●
● ● ●
●
●
●●
●
●
●●
●
●
●●
●
●
●
● ● ● ● ●● ● ● ●● ● ●●
●● ● ●●
●●●●●
●● ●●●●●●●● ●●●
●●
● ●●●
●●
●●
●
●
● ●
●●●●●
●●
●●
●● ●●
● ●
●●
●●
● ●●●●●
● ●● ●● ● ● ●●
● ● ● ● ●
●
●●
●
●
●●●
●
●
●
●
● ● ● ● ● ●● ●●●●●
● ●● ●●
●●●● ●●
●●
●●●
●●●
●
●●
●●
●●●●
●●● ●●
●
●●●●●●●●
●
● ●
●● ●●
●● ●
● ● ●● ●
●
●●
●
●
●●
●
●
●●
●
●
●
● ● ● ●
●● ●● ● ●● ●
● ●●
● ●●● ●●
●
●●●
●●
●
●●
●●●● ●●● ●● ●●
● ●●●
●●● ●
●
●
●●● ●●
●●●
●
●●
●●●●
●●●
●● ●
●●●●
●● ●● ● ●● ● ●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
● ● ●●●●● ●● ●●● ● ●●●
● ● ●●●● ●● ●●●●●
●●● ●●
●● ●
●
●●●
●● ●●● ●●
●●
●●●
● ●● ●
● ●●●
●●●●
●●
●●
●●●●●
● ●● ●● ●
●
●●
●
●
●●
●
●
●●
●
●
●
● ●● ●●●● ●●● ● ● ●●●●●●●●
●●●●
●
● ●●● ●●
●●
● ●●
●● ●● ●
●
●●
●
●
●●
●
●
●●
● ●●● ● ● ●● ●●● ● ● ●● ●● ● ●● ●
● ●● ●● ● ● ● ●●
●
●
●●
●
●
●●
−10
● ● ● ●● ● ● ● ● ●●
●●●
● ● ●●●●●
●●● ●● ●● ●● ●●●●● ●●●●●● ●
● ● ●● ●
●●
●
●
●
●●
● ●
●
●
●●
●
●
●●
●
●●
●
●
●
● ● ● ●●●●●
● ●●
●● ● ●●
● ● ●●● ●●●
● ●●●●●● ●
●
● ●
●●
●
●
●●
●
●●
●●
●
●
●
●●
●
● ●
●●
●●
●
● ● ●● ● ●● ● ●●
●
●
●●
−2
● ● ● ●●● ● ● ●
●●
●
●
●● ● ● ●●●● ● ●●
● ● ● ●
● ●●
●
●●
●
●
●●
●
●●
●
●●
●
●●
●
●●
● ● ● ●
●
●●
●
●●
●
●●
●
●
●● ● ● ●●
●●
●
●●
●
● ●
●●
●
●●
●
●
●●
●
●●
●
●
●●
●●
●●
●
●●
●●
● ●●●
●
●
● ● ●●●●●●
●
●
● ●
●
8 10 12 14 16 18 −3 −2 −1 0 1 2 3
Fitted values Theoretical Quantiles
Scale−Location Residuals vs Leverage
Standardized residuals
Standardized residuals
0.0 0.5 1.0 1.5 2.0
● 0.5
●
●
4
●
● ●
● ● ●● ●
● ● ● ●
●● ● ●
● ●
● ● ● ● ●
●
●●●
● ● ● ● ● ● ●
●
● ● ●● ●● ● ●● ●● ● ●● ●●
●● ● ●
● ●● ●● ● ● ●● ● ●
● ● ● ●● ● ●●● ● ● ●● ● ● ●● ● ●● ●
●●●●●●
●
● ●
●
● ●●● ● ● ● ● ●●●● ●●
●● ●● ●●●●
● ● ●
●●●● ●
● ● ● ● ● ● ●●● ●● ● ● ● ●● ●●●
●●
● ●●
● ●● ●● ●
● ●● ●●
●
●
●
●●
● ● ●
● ● ●
2
● ●● ● ●●● ● ●●● ● ● ●● ●
●●
●
● ●
● ● ● ● ● ●●● ● ●●● ●●●●● ●●●
●● ● ●●●●●
● ● ●●
● ●● ●● ●
●
●
●
●
●
●
●
●●
●
●●
●●●
● ●● ●
● ● ●● ● ● ●
● ● ● ●● ●● ●●● ●● ● ●
● ● ●●●●
●● ●●
●● ●●●●● ●●●
●●●●●●●
● ●●● ●● ● ●● ●● ●●
●● ● ● ●
●
●
●
●
●
●
●
●●
●●●●● ● ●
● ● ●
● ● ●●● ●● ●● ●●●● ● ●
●
●●●●●●●●
● ●
●●●●●●● ● ●●●
●
● ●● ● ●●●
● ● ●● ●
●●● ● ●
●
●
●●
●
●
●
●●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●● ●● ● ● ● ●
● ● ● ●● ● ●● ●
● ●● ●
●●● ● ●●●●●● ●● ●●
● ● ●● ●●● ● ●●●●● ● ● ● ●
●
●
●●
●
●
●
●●
●
●●●●
●●●● ● ●● ● ●
● ● ● ●● ● ● ● ●● ● ● ●●● ● ●● ●●● ●●● ●●
●
●
● ●● ●
●
●●●●
●● ●●●
● ●●
●
● ●
●●●●
●
●●●●●● ●●●●
●●●●●●
●
●
●●
● ●●●● ● ●●
● ● ● ● ●●●● ● ●●
●
●
●●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●● ● ● ●●
●
● ● ● ● ●● ●●
● ●● ●● ●
●● ●●
●●
●●●●
●
●
●●
●●●●●● ●● ●●●●●● ●
●
●●
●
●●
●●
●
●● ●
● ●●●●
●
● ●●
●●●
●●
● ●
●●●
● ●●
●● ● ●●
●●● ● ●
●
●● ●● ● ●
●●●● ●● ● ●
●
●
●
●
●●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●●●●● ●●
● ●● ● ● ● ● ●
●
●
● ● ● ●●●
● ●● ● ●● ●● ●●●
●●
● ● ●●
● ●●
●●●
●●●
●
●●●
●●
●
●●●
●
●
●
●
● ●
●
●
●
●
●
●
●●
● ●●
●●
●●●
●●
●●●●
●
●
●●●
● ●●●
●
●
●●● ●
●●●
● ●●● ●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●● ●●
●
●
● ● ●● ●●●
● ●
● ● ● ●● ● ●●●● ● ●● ● ● ●
●● ●●●●●●
●● ●
●●●
●● ●●●● ●
●● ● ●
●●●●
●●●●●●● ● ●
●● ●●● ● ● ● ●● ● ●
●
●
●●
●
●
●●
●
●●
●
●●●● ●
● ●● ●● ● ●●●●● ●●
● ●● ●●●●●● ● ●●● ● ● ●● ● ● ●
●
●
●●
●
●
●
●●
●●
●●● ● ● ●
● ● ●● ●● ● ● ●●● ●●●● ● ● ● ● ●● ●●●●
●●●●
●●●
●●●● ●●●
●● ● ●●
●
●●●●●●
● ●●●
●
●
●
●●
● ●
●●
●●
●● ● ●● ●●● ●●●● ●●●● ●
●● ●
● ● ●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●●
●
●●
●●●●●● ● ● ●
● ● ●● ● ● ●● ● ●● ● ● ● ●● ● ●●
●● ●●●●
●●
●● ●
●●●●●●●●● ●●
● ●
● ●●
●●
●
●●●●
●●
●●●●●●
● ●●
●
● ●●
●●●● ●● ● ● ●● ●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●●●
●
●● ● ● ● ●
● ● ● ● ●●
●● ●●●●● ●●
●●●
●●
●
●●
●
●●● ●●● ●●
●●●
●●●●
●●
●
●
●
●●●●
●●
●
●●
●
●●
●
●● ●
●●●●
●● ●●
● ●●
●●●
●
●●
●
●●
● ●●●● ● ● ●●●●
● ●●
●●●● ● ● ● ●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●● ●
● ●● ● ● ● ● ●● ● ●
● ●● ● ● ●●●●●●● ● ●●●●
● ●●
●●●● ● ●● ●●●● ●●●
●● ● ●●
0
●● ●● ● ● ●
●● ●●●
●●●● ● ● ●● ●●
●
● ●●●●● ● ● ●
●●●●●●
● ●●●●
●●●●●●
●●
●●
●
●●●●
●
●●●●● ●●
●●●●●● ● ●●●●
●●●
●● ●● ● ● ●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●●●
●●
● ● ●● ●●● ●● ●●●
● ● ●
● ● ●●●●● ●●●●●
●●●
●●●
●●
● ●● ●● ●
●●●● ●●●●
●●●●●●●
●●●●●
● ●●
● ●●
●●●● ●
●
●●●●● ●●● ●●
●●●● ●● ● ●
●
●
●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●
●
●●
● ●●●●●●● ●●
● ● ● ●●● ● ● ● ● ●●● ● ●●● ●
●●
●●
●● ●
●
●●●●
●●
●●●
●●● ●● ●●●
●
● ●●● ●● ●
●
●●
●
●●●●
●●●●●●
● ●●
●●● ●● ●●● ●●
●● ● ●● ● ●●● ●
●
●
●
●
●
●●
●
●
●
●
●●
●
●
●
●●
●
●●●
●
● ●●●●●
● ● ● ●
●
●●● ●●●● ●● ●● ●
●●●●●
● ●●●
●● ●
●● ●●●●●●●●
●●●●●●
●
●
●●●
●● ●●●
●
●
●
●●●
● ●●●
●●
●●
●
●●●●
●● ●●●
●
●●●●●
● ●● ●●
●
●● ●●
●●●● ●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●●
●
●
●
●●● ● ● ●
●
● ● ●
●● ● ● ●●●● ●●● ● ●●● ●
● ●●●●●
●● ●● ●●
●●●●●
●●
●● ● ●●●●
●●●
●●●
●● ●
●●●●●
●
●●
●● ●● ●●
●●
● ● ●
●●● ●●
●● ●●●
●●●●
●●● ● ●● ●
●
●
●
●
●
●
●●
●
●
●●
●
●
●
●●
●●●
●●●●●●●
● ●● ●●●● ●●●● ●●●
●● ● ●●●
●●●●● ●●
●●● ●●● ●
●●
●● ●
●●● ●●
●● ●
●
●
●●●●
●
●●●● ●● ●●
● ●●
●●● ●●● ●● ●● ●●●●● ● ● ● ● ● ● ●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●● ● ● ●● ● ● ●
●
●● ●●
● ● ● ●●● ●●
● ● ●●●●●● ●● ●●●
●● ●● ●●●● ●
●●●
● ●●●
●●●● ●● ● ● ● ● ●● ● ●
●
●
●●
●
●●
●
●●
● ● ●
● ●●● ● ●● ●●●●●
●
●●●●●●●●●
●●●●
●●
●● ●
●● ●●●●●●
● ●●●
● ● ●●●●
● ●
●●●●
●●● ●● ●●●
●●●● ●●● ●
●●
●●●● ●
● ● ● ●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
● ●
●
●● ●● ●
●●
● ●
● ● ●● ● ●●● ●●●
● ●●●● ● ●●
●● ●●
● ●●●
●● ● ●● ●
●
●●● ●● ●●●●
●●
●●
●
● ● ● ●● ●
●
●
●●
●
●
●●
●●
●●● ● ●
● ● ● ●●●● ● ●● ●●●●
●●●● ●●●
● ●●
●●●●● ●
●●
●● ●●● ●
●●●●●●
● ●● ●●●●
● ●●●●●●●●● ●●● ●●●●
●
● ●●●● ● ●●
●
●
●
●
●
●
●●
●
●
●
●●
●
●●
● ●
●● ● ● ● ● ●●●●●●● ● ● ● ●●
● ●●
●
●●
●
● ●●
●
● ●● ●
● ●●●●
● ●●
●●●●
●●●● ●●●
●●●
●
●●
●●● ●●
● ●●●●● ● ●●
●
●
●
● ●● ●
●●●●
● ●● ● ●● ●●
●●● ●● ●
●
●
●
●
●
●
●
●
●
●●
●●
●
●
●
●
●
●
●
●
●
●
●●●
● ●●
●
● ●
● ● ●
●●
● ●● ●● ●●●● ● ●●● ● ●● ●●
● ●●●●●●●●●
●● ●
●●● ● ●
● ● ● ●●● ●
● ● ● ●
● ● ●● ● ● ● ●
●
●
●●●●
● ●
● ● ●●● ●●
● ●●
●●●● ● ●
●
●●
●
● ●
●
−2
● ● ●●●●● ●● ● ●●● ● ●● ● ●
●●
● ● ●●● ● ●●●
●● ●● ●●●●
●● ● ●●●●●●● ●● ● ●
●● ● ●
● ● ● ●
●
●
●
●
●
●●
●●
●●● ● ●
● ● ●●● ● ● ●
●● ●●●●●●●●● ● ● ●
● ●● ● ● ● ●● ●●●●●●●
● ●●
●●●
●
●
●
●●●
●●● ●●●● ● ●●●●● ● ●●● ●●
●
●●
●
●
●
●
●
●
●
●
●
●
●●
●
●
● ● ● ●
● ● ● ● ●●●●
●● ●● ● ●●
● ●● ● ●● ● ● ●
●
●● ● ●
● ●● ● ●● ● ● ●●● ● ●
●
● ● ●●●
●
●● ●●● ●● ● ●●● ●●● ● ●
●●● ●●●
● ●● ●●
●● ●● ● ●● ● ● ●● ● ●
●
●
●●
●●
●● ●
●● ● ● ● ● ● ● ● ● ●●●● ● ●●● ●● ●● ● ●
● ●●● ●● ●● ●●● ●● ● ● ● ●
●
●
●●
●
●●● ●
● ●● ●
●●● ●● ●● ● ● ● ●●
●● ● ●
● ●● ●
●●● ● ●● ● ●● ●
●●● ●
●● ● ●● ● ● ●●
● ●● ● ● ● ●
● ● ● ●● ● ●●● ●●●●●
● ●●● ●
● ● ●● ● ●●●●● ● ● ●● ●● ● ●
● ● ● ● ●●● ● ● ●●● ●●
●● ● ●● ●● ●●
● ● ● ● ●● ●● ● ● ● ●● ●●●● ●● ●● ●
●●● ●● ● ●●● ● ● ● ●
● ● ● ●●● ● ● ●
●● ● ●● ●● ● ● ●●●●● ●
● ●● ●
● ● ● ●● ● ●● ● ●
● ● ●● ● ● ● ● ●●●● ● ● ● ● ●
●
●
●
●
● ●●● ● ● ● ● ●
● ● ●
● ● ●●●
●●
●
●●●
●●
●● ● ● ● ●
●
● ●● ●●
●●
●● ● ●●●● ● ●●●
● ●
● ● ●● ●
●●
●
● ●
●
Cook's distance
−4
●
10
●
●
●
●
● ●●
5
● ● ●
● ●
● ● ●●● ●
^ε
● ●
● ●
● ●● ●
● ● ●●
●●● ●●●●●● ● ●
0
● ● ●
● ● ● ●● ●●● ● ● ●
●● ● ●●●● ●● ● ● ●● ● ● ●
● ● ● ●● ●●●●● ● ● ● ● ● ●● ● ●● ● ●
●
● ● ● ● ● ●
●
● ● ● ●● ● ● ● ●
● ● ●
● ● ● ●
●●
●● ●● ● ●
●
●
−10
●
●
●
I y = Xβ + ε
I Gaussian errors: ε ∼ N(0, σ 2 I)
⇒ y ∼ N(Xβ, σ 2 I)
⇒ E(y) = Xβ; Var(y) = σ 2 I
54 / 327
Alternative Representation of linear models
I y = Xβ + ε
I Gaussian errors: ε ∼ N(0, σ 2 I)
⇒ y ∼ N(Xβ, σ 2 I)
⇒ E(y) = Xβ; Var(y) = σ 2 I
54 / 327
Recap: Linear Models
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: Naive Approach
Data:
I binary target y (0 or 1)
I metric and/or categorical x1 , . . . , xp
naive estimates:
ŷi = β̂0 + β̂1 xi1 + · · · + β̂p xip
I ŷi not binary
I could try to interpret ŷi as P̂(yi = 1)
I no variance homogeneity
I ŷi < 0 ? ŷi > 1? ⇒ ŷi must be between 0 and 1
Idea:
P̂(yi = 1) = h(x>
i β̂) with h : (−∞, +∞) → [0, 1]
55 / 327
Binary Target: GLM Approach
I yi ∼ B(1, πi )
I model for E(yi ) = P(yi = 1) = πi
I use response function h: π̂i = h(x> i β̂)
or linkfunktion g : g (π̂i ) = xi β̂ where g () = h−1 ()
>
Logit-Model:
exp(x>
i β̂)
π̂i = h(x>
i β̂) =
1 + exp(x>
i β̂)
56 / 327
Binary Target: GLM Approach
I yi ∼ B(1, πi )
I model for E(yi ) = P(yi = 1) = πi
I use response function h: π̂i = h(x> i β̂)
or linkfunktion g : g (π̂i ) = xi β̂ where g () = h−1 ()
>
Logit-Model:
exp(x>
i β̂)
π̂i = h(x>
i β̂) =
1 + exp(x>
i β̂)
56 / 327
Binary Target: Coefficients of the Logitmodel
exp(x>
i β) πi
πi = ⇔ log = x>
i β̂
1 + exp(x>
i β) 1 − πi
πi
⇔ = exp(β0 ) exp(β1 xi1 ) . . . exp(βp xi )
1 − πi
57 / 327
Binary Target: Coefficients of the Logitmodel
exp(x>
i β) πi
πi = ⇔ log = x>
i β̂
1 + exp(x>
i β) 1 − πi
πi
⇔ = exp(β0 ) exp(β1 xi1 ) . . . exp(βp xi )
1 − πi
57 / 327
Binary Target: Coefficients of the Logitmodel
exp(x>
i β) πi
πi = ⇔ log = x>
i β̂
1 + exp(x>
i β) 1 − πi
πi
⇔ = exp(β0 ) exp(β1 xi1 ) . . . exp(βp xi )
1 − πi
57 / 327
Binary Target: Probit- & cloglog-Models
Probit-Model:
use standard-Gaussian ECDF as response function:
π̂i = Φ(x>
i β̂)
cloglog-Model:
response function:
π̂i = 1 − exp(− exp(x>
i β̂))
58 / 327
Binary Target: Probit- & cloglog-Models
Probit-Model:
use standard-Gaussian ECDF as response function:
π̂i = Φ(x>
i β̂)
cloglog-Model:
response function:
π̂i = 1 − exp(− exp(x>
i β̂))
58 / 327
Binary Target: Probit- & cloglog-Models
Probit-Model:
use standard-Gaussian ECDF as response function:
π̂i = Φ(x>
i β̂)
cloglog-Model:
response function:
π̂i = 1 − exp(− exp(x>
i β̂))
58 / 327
Binary Targets: Expectation and Variance
59 / 327
Binary Targets: Expectation and Variance
59 / 327
Binary Targets: Expectation and Variance
59 / 327
Binary Targets: Expectation and Variance
59 / 327
Example: Patent Injunctions
60 / 327
Binary Target: R-Implementation
## 2.5 % 97.5 %
## (Intercept) 0.462 0.355 0.601
## uszwUSPatent 0.676 0.592 0.772
## jahr 0.931 0.915 0.947
## azit 1.125 1.095 1.157
## aland 1.088 1.066 1.111
## ansp 1.018 1.011 1.025
## brancheBioPharma 1.975 1.676 2.328
## herkunftD/CH/GB 1.381 1.174 1.625
## herkunftUS 0.859 0.741 0.997
## estimated
## einspruch 0 1
## nein 2223 624
## ja 925 1094
Count Data as Targets
Daten:
I positive, whole number target y (counts, frequencies)
I metric and/or categorical x1 , . . . , xp
⇒ naive estimates Ê(yi ) = x>
i β̂ could become negative
⇒ model log(Ê(yi )), i.e,
Ê(yi ) = exp x> i β̂ = exp(βˆ0 ) exp(βˆ1 xi1 ) . . . exp(βˆp xip )
63 / 327
Count Data as Targets
Daten:
I positive, whole number target y (counts, frequencies)
I metric and/or categorical x1 , . . . , xp
⇒ naive estimates Ê(yi ) = x>
i β̂ could become negative
⇒ model log(Ê(yi )), i.e,
Ê(yi ) = exp x> i β̂ = exp(βˆ0 ) exp(βˆ1 xi1 ) . . . exp(βˆp xip )
63 / 327
Count Data as Targets
Daten:
I positive, whole number target y (counts, frequencies)
I metric and/or categorical x1 , . . . , xp
⇒ naive estimates Ê(yi ) = x>
i β̂ could become negative
⇒ model log(Ê(yi )), i.e,
Ê(yi ) = exp x> i β̂ = exp(βˆ0 ) exp(βˆ1 xi1 ) . . . exp(βˆp xip )
63 / 327
Count Data as Targets
Daten:
I positive, whole number target y (counts, frequencies)
I metric and/or categorical x1 , . . . , xp
⇒ naive estimates Ê(yi ) = x>
i β̂ could become negative
⇒ model log(Ê(yi )), i.e,
Ê(yi ) = exp x> i β̂ = exp(βˆ0 ) exp(βˆ1 xi1 ) . . . exp(βˆp xip )
63 / 327
Count Data as Targets: log-linear Model
Distributional assumption:
I yi |xi ∼ Po (λi ) ; λi = exp(x>
i β)
⇒ E(yi ) = Var(yi ) = λi
Overdispersion:
I Frequently Var(yi ) 6= λi :
⇒ more flexible model with dispersion parameter φ:
Var(yi ) = φλi
⇒ alternative distributions: Tweedie, Negative Binomial
64 / 327
Count Data as Targets: log-linear Model
Distributional assumption:
I yi |xi ∼ Po (λi ) ; λi = exp(x>
i β)
⇒ E(yi ) = Var(yi ) = λi
Overdispersion:
I Frequently Var(yi ) 6= λi :
⇒ more flexible model with dispersion parameter φ:
Var(yi ) = φλi
⇒ alternative distributions: Tweedie, Negative Binomial
64 / 327
Exampe: Patent Citations
## df AIC
## pat2 9 21021.23
## pat3 10 16341.48
round(cbind(
summary(pat2)$coefficients[2:5, -c(3, 4)],
summary(pat3)$coefficients[2:5, -c(3, 4)]
), 3)
66 / 327
Definition: GLM
exp(x>
i β)
I logit regression: E(yi |xi ) = P(yi = 1|xi ) = 1+exp(x>i β)
I log-linear model E(yi |xi ) = exp(xi β)
I Distributional assumption: Given independent (xi , yi ) with
exponential family density f (yi ):
yi θi −b(θi )
⇒ f (yi |θi ) = exp φ ωi − c(yi , φ, ωi ) ; θi = θ(µi )
I E(y |x ) = µ = b 0 (θ ) = h(x> β)
i i i i i
I Var(y |x ) = φb 00 (θ )/ω ; ω = n
i i i i i i
66 / 327
Definition: GLM
66 / 327
Definition: GLM
66 / 327
Simple Exponential Families
Normal N(µ, σ 2 ) µ θ2 /2 σ2
µ
Bernoulli B(1, µ) log( 1−µ ) log(1 + exp(θ)) 1
Poisson Po(µ) log(µ) exp(θ) 1
Gamma G (µ, ν) −1/µ − log(−θ)
√ 1/ν
Inverse Gauß IG (µ, σ 2 ) 1/µ2 − −2θ σ2
67 / 327
Simple Exponential Families
Normal µ=θ 1 σ 2 /ω
exp(θ)
Bernoulli µ = 1+exp(θ) µ(1 − µ) µ(1 − µ)/ω
Poisson µ = exp(θ) µ µ/ω
Gamma µ=1− √ 1/θ µ2 µ2 /(νω)
Inverse Gauß µ = 1/ −2θ µ3 µ3 σ 2 /ω
68 / 327
R-Implementation: glm()
69 / 327
Advantages of GLM-Formulation
70 / 327
Recent Extensions:
71 / 327
Outline
72 / 327
ML Estimation: Idea
Pn > 2
OLS estimate in linear model: i=1 (yi − xi β) → min
I
√ Pn
(y −x> β)2
density for y: ni=1 f (yi |β, xi ) = ( 2πσ)−n exp − i=1 2σi 2 i
Q
I
72 / 327
ML Estimation: Idea
Pn > 2
OLS estimate in linear model: i=1 (yi − xi β) → min
I
√ Pn
(y −x> β)2
density for y: ni=1 f (yi |β, xi ) = ( 2πσ)−n exp − i=1 2σi 2 i
Q
I
72 / 327
ML Estimation: Idea
Pn > 2
OLS estimate in linear model: i=1 (yi − xi β) → min
I
√ Pn
(y −x> β)2
density for y: ni=1 f (yi |β, xi ) = ( 2πσ)−n exp − i=1 2σi 2 i
Q
I
72 / 327
ML Estimation: Idea
Pn > 2
OLS estimate in linear model: i=1 (yi − xi β) → min
I
√ Pn
(y −x> β)2
density for y: ni=1 f (yi |β, xi ) = ( 2πσ)−n exp − i=1 2σi 2 i
Q
I
72 / 327
ML Estimation: Procedure
Pn
I log-likelihood l(β) = i=1 log(f (yi |β, xi ))
∂
I score function s(β) = ∂β l(β)
I (iterative) solution for s(β) = 0
via Fisher-Scoring or IWLS
73 / 327
ML Estimation: Fisher-Scoring
I basically Newton method:
−1
β (k+1) = β (k) − ∂β∂> s(β) s(β)
Newton−Verfahren
β(0)
s(β)
β(1)
β(2)
β
74 / 327
ML Estimation: Fisher-Scoring & IWLS
75 / 327
Properties of ML Estimators
76 / 327
Tests
Linear hypotheses H0 : Cβ = d vs HA : Cβ 6= d
Estimation for β under restriction H0 : β̃
I LR-Test:
lq = −2(l(β̃) − l(β̂))
I Wald-Test:
I Score-Test:
u = s(β̃)> F−1 (β̃)s(β̃)
a
under H0 : lq, w , u ∼ χ2r , r = rank(C) (no. of restrictions)
⇒ rejecct H0 if lq, w , u > χ2r (1 − α).
77 / 327
Tests
Linear hypotheses H0 : Cβ = d vs HA : Cβ 6= d
Estimation for β under restriction H0 : β̃
I LR-Test:
lq = −2(l(β̃) − l(β̂))
I Wald-Test:
I Score-Test:
u = s(β̃)> F−1 (β̃)s(β̃)
a
under H0 : lq, w , u ∼ χ2r , r = rank(C) (no. of restrictions)
⇒ rejecct H0 if lq, w , u > χ2r (1 − α).
77 / 327
Tests
Linear hypotheses H0 : Cβ = d vs HA : Cβ 6= d
Estimation for β under restriction H0 : β̃
I LR-Test:
lq = −2(l(β̃) − l(β̂))
I Wald-Test:
I Score-Test:
u = s(β̃)> F−1 (β̃)s(β̃)
a
under H0 : lq, w , u ∼ χ2r , r = rank(C) (no. of restrictions)
⇒ rejecct H0 if lq, w , u > χ2r (1 − α).
77 / 327
Tests
Linear hypotheses H0 : Cβ = d vs HA : Cβ 6= d
Estimation for β under restriction H0 : β̃
I LR-Test:
lq = −2(l(β̃) − l(β̂))
I Wald-Test:
I Score-Test:
u = s(β̃)> F−1 (β̃)s(β̃)
a
under H0 : lq, w , u ∼ χ2r , r = rank(C) (no. of restrictions)
⇒ rejecct H0 if lq, w , u > χ2r (1 − α).
77 / 327
Tests
Linear hypotheses H0 : Cβ = d vs HA : Cβ 6= d
Estimation for β under restriction H0 : β̃
I LR-Test:
lq = −2(l(β̃) − l(β̂))
I Wald-Test:
I Score-Test:
u = s(β̃)> F−1 (β̃)s(β̃)
a
under H0 : lq, w , u ∼ χ2r , r = rank(C) (no. of restrictions)
⇒ rejecct H0 if lq, w , u > χ2r (1 − α).
77 / 327
Tests in R
√ a
summary.glm uses w ∼ N(0, 1) for H0 : βj = 0:
round(summary(pat2)$coefficients[8:9, ], 3)
79 / 327
Model Diagnostics: Residuals
80 / 327
Model Diagnostics: Residuals
80 / 327
Model Diagnostics: Residuals
80 / 327
Model validation: plot.glm()
●●●●● ●●●●● ●●
●
●
●
●
●●
● ●● ● ● ●● ●● ●● ●● ●
●●
●
●●
●
●
●●●● ●● ●● ●● ● ● ●
● ●
●● ●
● ●●
●
●●
●
●
●
●●
5
5
● ● ●
●● ● ●
●
●
●●●● ●
●
●●
●
●●●●●
●
●
●●
●●
●
●
●●
●
●●
●
●●
●●●
●
●●
●●
●
●●●
●
●
●
●● ●
●
●
●●●
●
●
●●●
●
●●
●
●
●
●
●●●●●
● ●
●●● ●
●●
●
●
●●
●
●
●
●●
●
●
●●
● ● ●
●
●
●●●
●
●●●
●
●
●●
●
●●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●●●
●
●
●
●
●
●
●
●
●
●
●
●●
●●
●
●
●●●
●
●●
●
●
● ●
●
●●●
● ● ●● ●
●
●●
●
●
●●
●
●
●●
●
●
●
●●
●
●
●●
●
●
●●●●
●●●
●
●●
●●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●
●
●
●●
●
●●
●
●●
●●
●
●●
●
●
●●
●
●
●●
●
●●
●
●
●●
●
●●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●●
●
●●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●
●●
●
●
●
●
●●
●
●
●
●●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●●
●
●●
●
●●
●
●
●●●
●
●●●
●
● ●●●●
●
● ●●
●
●
●
●●
●
●
●●
●
●
●
●●
●
●
●●
●
●●
●●●●
●●
●●
● ●
●
●
●●
●
●●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
●●
●
●
●●
●●
●
●
●●
●
●
●●●●
●
●
●●
●●
●
●
●●
●
●
●●
●
●
●●
●
●●
●
●●
●
●
●●
●
●
●
●●
●
●
●●
●
●●
●
●●
●●
●
●
●●●
●●
●●
●●● ●
● ● ●
●
●●
●
●
●
●
●●
●
●●
● ●
●
●
●
● ●●●
●●
●●
●●
●
●●
●
●
●●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●
●●
●
●
●●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●●●
●
●
●
●●
●
●
●●
●
●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●●
●●
●
●●
●
●●●
●
●
●●
●
●
●●
●
●●
●
●
●●
●●
●
●●
●●
●
●
●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●
●●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●●●
●
●
●
●●
●●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●
●●
●
●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●●
●●
●
●●● ●●
●
● ●
●
●
●
●●
●
●
●●
●
●
●
●●
●●
●●
●
● ●
●
●
●
●
●●
●
●●
●
●●
●
●●
●●
●
●●
●● ●
●
●
●●
●
●
●
●
●●
●●
●
●●
●
●
●●
●
●●
●●
●
●●
●
●●
●
●●
●●
●
●
●
●●
●
●●
●
●●
●
●●
●●
●
●
●●
●
●
●●
●
●●●
●
●
●●
●
●
●
●●
●
●
●●
●
●●
●
●
●●
●●●
●
●
●●
●
●●
●
●●
●
●●
●●
●●
●
●
●●
●
●●
●●
●
●
●●
●
●
●
●●
●
●
●
●
●
●●
●●
●
●
●
●●
●
●●
●
●
●
●●
●
●
●●
●
●●
●
●●
●
●●
●●
●
●
●●
●
●
●●
●
●●●
●
●
●
●●
●
●
●●
●
●●
●
●●
●●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●●●●
●●●
● ● ● ●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●●
●
●●
●
●
●
●●
●●●
●
●●●
●
●
●
●●
●
●
●
● ●
●●
●●
●
●
●●
● ●
●
●●
●
●
●
●●
●
●●●
●
●
●
●
●●
●●●
●
●●
●
●
●
●● ●
●
●●
●
●●
● ●
●
●●
●●●
●
●●●
●
● ●
●
●
●●
●
●
●●
●
●
●●
● ●
●●
●
●
●●●
●
● ●
●●
●
●●
●
●●
●●
●●
●●
●
●●
●●
●
●
● ●●
●
●
●
●
●●
●
●●
●
●
●●
●●
●●
●
●
●
●●
●
●
●
●
●●
●●
●●●●●
●●● ●●
●●
●
●●
●
●●
●
●
●●
●
●●
●●
●
●
●
● ●●
−5
−5
●●
● ●
−5 5 15 25
● 4743 1871 ● ● ● 2796
3.0
● ●
●
● ●●●●● ●
● ●● ●● ● ●
● ● ● ●● ● ●●●● ●●●● ● ●● ●●
● ●
●●●●● ● ●● ●●●●●●●●
● ●
●
●● ●
●● ●●
●
●
●●
●
●
●
●
●
●
●
●●●●●
●
●
●
●
●
●
●●●
●
●
●
●
●
●●
●
● ●●
●●●●
●
●
●
●
●●
●
●●●●
●●
● ● ●
●
●
●
●
● ● ●
● ●●●●●●
●●
●●●
●
●●
●●
●●
●
●●
●
●
●●●
●●
●
●●●
●●●
●
●
●●
●●●● ●●●●
●●
●●●
● ●●●● ●●●●●●●●
● ● ●
●
●
1.5
●●
●●●
●● ●●●
●●
●●
●
●●●
●
●●
●●●●
●● ●●
●
●
●●●
●
●●
●
●●●
●
●●● ●
● ●
● ●
●●●
●
●
●●
●
●
●●
●
●●
●●
●
●
●●
●●
●●
●
●●
● ●
●
●
●●
●●●
●
●●
●
●
●
●
●
●
●
●
●●
●●
●●
●
●●
●●
●
●●
●●
●
●
●●
●
●
●
●
●
●●●
●●
●
●●●
●
●
●
●
●●
●
●●
●
● ●
●
●
●●
●
●
●
●●
●
●●
●
●●
●
●●
●
●
●
●
●●
●
●
●
●
●●
●
● ●
●
●
●
●
●
●
●●
●
●
●●●
●●
●●
●
●
●
●●
●
●●
● ●
●
●●
●
●●
●
●
●
●
●
●
●●
●
●
●
●●
●●
●
● ●
●
●
●
●
●
●
●
●
●
●
●
●●
●●●
●●
● ●●●●
●
● ●
●●
●●●● ●
●
●
●
●
●
●
●
● ●
●●
● ●
●
●
●
●
●●
●
●
●
●●
●●
●
●
●
●●
●
●●
●●
●
●●
●
●●
●
●●
●
●
● ●●
●
●
●
●
●
●●
●
●
●●
●●
● ●●
●
●
●
●●
●
●●
●
●●●
●
●
●
●●
●
●
●
●
● ●
●
●
●
●●
●
●
●●
●
●●
●
●
●●
● ●
●
●●
●●
●
●●●
●●
●
●
●
●●
●
●●● ●
●●
●
●●
●
●●
●
●
●●
● ●●
●●
●
●●
●●
●●
●
●●
● ●
●●●
●
●
●●
●
●
●●
●●
●
●●
●● ●● ● ● ●● ●●
●
●
●
●
●●
●●●
●
●
●●
● ●
●
●●
●
●
●●●
●
●●
●
●●
●
●
●●
●
●●
●●
●
● ●
●
●
●●
●
●
●●
●
●
●
●●
●
●
●
●●
●
●
●●●
●
●●
●
●
● ●
●
●●
●
●●
●
●
●●●
●
●●●
● ●
●●
●
●●
●
●●
●
●●●●
●
●●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●●● ●
●●
●●
●●
● ●
●●●● ●
●
●
●
●
●
●
● 1
● ● ●●
●
●●
●
●
●●
●●
●
●
●●
●
●●
●
●●
●
●
●●
●
●
●●
●
●●
●
●●
●
●●
●
●
●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●
●●
●
●
●●
●
●●
●●●
●●●
●
●●
●
●●
●●
●
●
●
●●
●
●●
●
●●
●
●●
●● ●● ●
●
●
●
●
●
●
●
●
●
●
●● 0.5
●●
●●●●
● ●
●●
●
●
●●
●
●●
●
●●●
●
●●
●
●●
●
●
●●
●
●
●●
●
●
●● ●
●
●●
●
●
●●
●●
● ●
●
●●
●
●●
●
●●
●●
●● ●●
●
● ● ●
●
●
●
●●
●
●●
●
●
●●
●
●●
●●
●
●
●● ●●
●
●
●●
●
●●
●
●●
●
●
● ●●●
●●
●
●●
●
●
● ●
●
●
●●
●
●●
●
●
●
●
● ●
●●● ●
●● ●●
●● ●●
●
●
●
●
●
●
●
●●
●
●● Cook's distance
●
●
●
●●
●
●
●●
●
●
●
●●
● ●
●
●●
●
●
●●
●
●
●●
●
● ●
●
●●
●
●●
●
●
● ●
●●
●
●●
●●
● ●
●
●●
●
●● ●
●●●●
●
●●
●
●● ●●
● 0.5
1
●
●● ●
●● ●● ●
● ●
● ● ● 3939 ● 4290 ●
0.0
●
●
●●
●●
●
● ●
●●
●
● ●
● ●
● ●
−0.5 0.0 0.5 1.0 1.5 2.0 2.5 0.0 0.1 0.2 0.3 0.4
82 / 327
Motivation
bla
blub
20
10
5
^ε
0
−10
20
● ●
● ● ● ●
● ●
15
15
● ● ● ●
● ●
● ● ● ● ● ●
● ● ● ● ●● ●
●● ● ●
● ● ●● ●
● ●● ● ● ●
● ●● ● ●●
● ●● ● ●
●
● ● ● ● ●● ● ●● ● ● ●
● ● ●
● ●● ● ●●
●●
● ● ● ● ●● ● ● ●
● ●
10
10
●● ●● ●● ● ●●● ● ● ●● ●
● ● ● ● ● ● ● ● ● ●
●●● ● ●●● ●●● ● ● ●
●
● ● ● ●● ● ● ●
● ●
● ●●● ●
●● ●
●●● ●
●
● ● ●● ● ● ● ●● ●●●● ● ●● ● ●● ● ● ●● ●● ● ● ●
●●
● ●●●●
● ●●
● ●●● ●●●● ● ● ●● ●
●
● ● ●●●
● ●●●● ● ●● ● ●●●●●● ●●●● ● ● ●
● ●
● ●
●● ●●● ● ● ●● ●● ● ● ● ●● ●
●●
● ● ● ●
●●●●● ●●●●● ● ● ●● ● ● ● ● ● ● ●● ● ● ●● ●●
● ● ●● ●●●●●● ● ● ● ● ●
●
●
● ●
● ●●●
●
●●●● ●●
●
● ●
●●
●
●
●● ●
●
● ● ● ●
● ● ●●
●● ●
●● ● ● ● ●●● ●
● ● ●●●●● ●●●●● ●
●
● ● ●
● ● ●●
●● ●
●● ● ● ●
●● ●●●●● ● ●● ● ●●● ● ● ● ● ●● ● ● ● ● ● ● ●●●●●●●●● ●●●
●●●● ● ● ● ● ●● ● ●
●●
● ●
●●●
● ● ●●● ●●
●
●● ●●
●
● ● ● ● ● ●● ●
●●● ● ●
● ●
●● ●●● ●●●●●●●●●●●
●
● ● ● ● ●
●● ●● ●● ● ● ●● ● ● ●● ●● ● ●●●● ● ● ●● ● ● ●● ●
●
● ●●●●●
●
●
●●●
●
●●
●●●
●
●●
●
●●
●●
●● ●●
●
●
●●
● ●●●●●
●●● ●●●
●
●● ●
●●
● ● ● ●●
●●
● ● ● ● ● ●●●● ●●
●● ●●●●●● ●●● ●●●●
●● ● ● ●● ●●●● ● ●●●
●
●● ● ●● ● ●●
●●
● ● ●
●
●● ● ●●●
●●●●●
●●●
● ● ● ●
●●
●
●● ●
●
●●
●
●●
●
●
●●●●●
●● ●● ●
●●●●●●● ● ● ● ● ● ● ●
● ●● ●
●●● ●●●●
●●●●● ● ●●
●●
●●
●
●●●●
● ●●
●● ●●
●●●●
●●
●●● ● ●
●●●●●●●● ● ● ●● ●
5
5
● ●●● ● ●
●●
●●●
● ● ●
●
●●●●●
●●
● ●
●
●● ●
● ●●●●●
● ●●● ●
●
● ●● ● ●● ● ● ● ●
●● ●●● ●●●
●●● ● ●●●●●●
●●
● ●●● ● ● ●●
●
● ●●●
● ●
● ●●● ● ●●● ● ● ●
● ●● ● ●● ● ●● ● ● ●●● ● ● ●● ● ●●●● ● ● ●●●●
● ●● ● ●
●●
● ● ●
●
●
●●●●● ●●
●●●
●●●
●●●●
●●●
●
● ●●
●● ●
●
●●●● ● ●● ●● ● ● ● ● ●●● ●
●● ● ●
●●●●●● ●●
●●●●●●● ●●●●●
●●●●● ●●
●●●
●
●
● ●●
●●● ●●●● ● ●● ●●
● ● ● ●
● ● ●●
●●
●●
●●
●
●●●
●
●●●
● ●
●
● ●
●●
●
●●●
●●●●
●
●●●
●
●●●
●●●
●●
●
●●●
● ● ●● ●
● ●●●● ● ●● ● ● ●●
● ●
●
● ● ● ●●●●●
●● ●●
● ●●●●●●●●
● ●●●
●●●
● ●●●
●
●
●●●● ●
●
●
●●
●●
●
●●●
● ● ●● ●
● ●● ●● ● ●●● ● ●● ● ● ●
●
● ● ●
●●
●●● ●●●
●
●●● ●●● ●
●●●●●●●
●●
●●
●
●● ●
●
●●● ●●●
●
●●●● ●
●● ●
●● ● ● ●
●● ●● ● ●● ● ●●● ● ● ●●
● ● ● ● ●● ●●● ●
●●●● ● ●● ●●
● ●
●●●
●● ●●
●●
● ●●●
●
●●●● ●
●● ●
●● ● ● ●● ● ●
● ● ●● ●
^ε
^ε
●● ●●● ● ●● ●●●● ● ●●
●●
● ●
●●●
●
● ●● ●
●
● ●●●
●
●
●
●●
●●
●
●●
●
●●●
●
●
●●
●
●●●
●
●●
●
● ●
●●●
●
●
●
● ●
●●●
●●
●●
●
● ●● ●●
●● ● ● ●●● ●●●●● ● ● ●●
● ●●●● ●●● ●
● ●●● ●●● ●●●● ●●●
●●
●●
●●
●●
●●
●
●
●
●
●
●●●
●
●
●
● ●
●●●
●●
●●
●
● ●● ● ●
● ● ● ● ●●●●
● ●● ●
●●●●● ●
●●
●● ●●●●
●●
● ●
●● ●● ●●●●●
●●●
●●●● ●
● ●
●●●● ●
●●
● ●
●●● ●
● ● ● ● ●● ● ● ● ● ● ● ●
●●●●● ● ● ●
●● ● ● ●●●●●●●● ●● ● ●●
●●
●●●●●●●● ● ● ●
●● ● ●
●●
● ●●● ●
● ● ●● ●● ● ● ●● ●●
●● ● ● ●●
●●●●
● ●●●●●● ●
●
●● ●●● ●● ●● ● ● ●●
● ● ● ●●
● ● ● ● ●●
● ●●●
●●
●●● ● ●●●●●●●●●
●● ●●●
●● ● ●●● ●●● ● ● ●●● ●●●● ●●
● ●
●●● ●●
● ● ●●
●●
●●
● ●●
●●●●●●●●●● ●
●●● ●●●●●
●●●
●●
●●●
●●
●● ●●● ●●●●● ● ● ● ● ●●●● ●●● ●● ● ●● ●● ●●●●●
●●●
●●
●●●
●●
●● ●● ● ● ●
● ● ●
●●●
● ●● ●●● ● ●●● ●
● ●●●●
●●● ●●●●●●● ●●●●●●● ●●● ● ● ●●●●● ●● ● ● ●●●●●●● ●●●●●●● ●●●
●●●●●●
●●● ●●●●●●● ●●● ●●●●●● ● ●
● ●● ●●
● ● ●●●
● ●● ●
● ●
● ● ●●
●●●● ● ● ●●● ●●● ● ● ● ● ●● ●●●●● ●● ● ●●
●●●● ● ● ●● ● ● ●●● ●● ●
●
●●● ●
●●●●●
●
●
●
●● ●
● ●
● ●●
●●
●●●
●●
●●●●
●●●
●●
●●●
●
●●
●
●
●
●
●
● ●
●
●
●
● ●●
●●
●● ●
●●
●●●
●●●
●
● ●● ●●●●
●
● ● ●
● ● ● ●●●
●●●●●● ●●●●●● ● ●●●●●●●●
●●●●●●●
●● ●●●
● ●
●●
●●●
●
●●
●
●
●
●
●
● ●
●
●
●
● ●●
●●
●● ●
●●●●●●●
●
●●●●
●●●●
●
●● ● ●
●
● ● ●
●
●
●● ●
●
●●●● ●●●●●●●
●●●●
●●●
●
●
●●
●●
● ●●
● ●●●●●
● ●
●
●●●●
●●
●●● ●●● ● ●●
● ● ●
●● ●●●●● ●●●
●●●● ●●● ●●● ●
●●●●●
● ●
●● ●
●
● ● ●●●
● ●
●
●●●●
●●
●●● ●● ● ●●●
●
0
0
● ● ● ● ●● ● ● ● ● ● ● ●● ● ● ● ● ●
●●●●
●● ●●●●
●●●●● ●●
●●
● ●
●●
●
●●●
●●●●
●●● ●
●●
● ●●
●●
●●●
●● ●● ●●
●
●
●
●
●
●
●●
●●● ● ●●
●
●● ● ●● ● ●●
● ● ●●
● ●●●
● ●
● ●●●● ●● ● ●● ●●●●●●●
● ●●●
●● ●● ●
●●● ●
●
●● ●
●●
●●
●
●●●
●● ●● ●●
●
●
●
●
●●
●●
●●●● ●●●
●● ●● ● ●●●
● ● ●●
●● ● ●
●●
●
●●
●●● ● ● ●●
● ●●
● ●
●
●
●●● ●
●●
●●
● ●
●
●
●
●●●●●●●●
●●
●
● ●●●●
● ● ●
●●
●● ● ●
● ● ●●
●
●●●
●
●●
●●●● ● ●●●●●●● ●
●● ●●
●
●●●●
●
●
● ●
●
●
●
●●●●●●●●
●●
●
● ●●●●
● ● ●
●●
●●●●●
●● ●●
●● ●
● ●● ●● ●
●● ●●●
●
●●●
●●
●●●●●
●●●
●
●●
●●●
●
●●●●
●●●●
●●
●●●●●●
●
●
●●
●●●
●
●●●
● ●●
● ●●●
●● ●
●
●●●
● ●● ● ● ● ●
● ● ●● ● ● ●●●●●●
●●●● ●● ●
●●
●●●●
●● ●●●
● ●
●
●●●●
●●
●●●●●●
●
●
●●
●●●
●
●●●
● ● ●
● ●●
●●
● ●
●
●●
●●●● ●●
● ●
●
●●
●● ●
●
●
●
●●
●
●
●
●
●
●●
● ●
●
●
●
●
●
●
●
●
●
●●
●
●
●
●
●●●● ●
●
●
●●
●●
●
●
●●●
●●
●●●
●
●
●●
●●
●
●
●●
●●
●
●●
●●
●●●●●
●● ● ●●● ● ● ● ● ● ●●● ● ●● ●●
●
●●
●
●
● ● ●●●
● ●●
●
●
●
●
●
●
●
●●
●
●
●
●
●●●● ●
●
●
●●
●●
●
●
●●●
●●
●●●
●●
●●
●●●
●
●
●●
●
●
●●
●●
● ●●●
●
●● ● ●●
● ● ●● ●
● ● ● ●●● ● ●●
● ●●
●● ●
●● ●●
●
● ● ●● ●
●●●●●
●● ●
● ●
● ●● ● ● ● ●● ●● ● ● ● ● ● ● ●
●●●●●●●●●● ●●●● ● ●●
●
● ● ●● ●
●●●●●
●● ●
● ●
● ●● ● ● ●●●
●
●●
●●
●●●●●
●● ●
●● ●●●●●● ●●
● ●● ● ● ● ●● ● ● ●
●● ● ●●●●●●●●●●
●
●●●●● ●●
● ●● ● ●● ●●● ●●
● ● ● ●●● ●●●●●
●
● ●●● ●
●●
●●●
●
●●●
● ●●
●●● ●●
●
●●●●
●
● ●
●●●
●●
●
●●●●●●●●
●●●●●●
● ●
● ● ● ● ● ●
● ● ● ●● ●●● ● ●●
●●●● ●●●●●●●●●
● ●●
●●● ●●
●
●●●●
●
● ●
●●●
●●●
●●●●●●●
●
●●●●●●
● ●
●● ● ● ● ●
●
●●●●●
●●● ●●
●●●
●
●●
●●●●
●
●
●
●●●●●
●●
●●
●
●●
●
●
●●●
●
●
●● ●
●
●●
●
●●
●
●
●●
●
●
●●
●
●
●
●
●●
●●
● ●● ●
●● ●● ●●●● ● ●● ● ● ●
● ●● ●●●●
●●●● ●● ●●●●
●●●● ●
●●
●
●●
●●●
●●
●●
●
●●
●
●
●●●
●
●
●●●
●
●
●●●
●
●
●●
●
●
● ●
●
●
●
●●●
●
●● ●●●●● ●
● ●●●●
●● ●●
●
●● ● ●● ● ●
●●●
●●●●
●●●
● ●●
●
●● ●
●●● ●●
●
●●
●●●●●
● ●
●●
●
●
●●●
●●
●
●
●●●
●
● ● ● ●
●
●
●● ●●● ●●●● ●
● ● ●
● ● ● ● ●●● ● ●●●
●●●●●●●●●● ●● ●● ●
● ●
●
●● ●●
●
●●
●●●●●
● ●
●●
●
●
●
●
●●
●●
● ●●●●
●
●● ● ●
●
●
●● ●●
● ●●●
●●●
●● ●
● ●●
●
●● ●
● ●●
●●
●●●●●
●●●●●●●
●
●
●
●●●
●
●●
●
●●
● ●●
●●●
●●●
● ●
●
●
●●●
●
● ●●
●
●●● ●
●●
●
●
●●
●
●
●
●● ●● ●
●●●●
● ● ● ●
● ● ● ●● ●●●●● ●●●●●●●
●● ●●●
●●●●
●● ●
●
●
●●●
● ●●
●●●
●●●
● ●
●
●
●●●
●
● ●●
●
●● ● ●
●
●● ●
●●●
●
●
●
●●●●● ●
●●
● ●●● ● ●
−10 −5
−10 −5
● ● ●● ●● ●●
●●● ●●● ● ●
● ● ● ● ● ●●●●
● ● ● ● ●● ●● ●●●● ● ● ● ●●●●
● ●● ● ●●● ● ●
●●
● ●●●
●● ●
●
●●●
● ●
● ●●●●●●
●● ●
●
● ●
●●
●● ●●● ●● ●
●
●● ● ●
● ● ● ●● ●● ● ●● ● ●●● ●●●
●
● ●
●●●●●●●●
●● ●
●
● ●
●●
●● ● ●●
● ●●●● ●
●●
●
● ●●
●●●●●●● ● ● ●
●
●●● ● ●●● ●
●
●●●●
●●
●
●●
●●●●
●●
●●●●● ●
●●●
●●●
● ●
●
●
●●●
●●●
●
●
●●●
●
● ●●●●●●
●●
●
●
●
● ● ●●
● ●●
●● ●●
●●
● ●
●●●●
● ● ● ●
●● ●
●
● ●●●●●●●●●●●●
●●●
●●
●
●●●●
●●● ●
●●● ●
●●●
●●●
●
●●
●
●●●
●●●
●
●
●●●
●●●
● ●●●●
●●
●
●
●
●●●●
●
●
● ●●
●●
●
● ●●● ● ●
● ● ●
● ●●● ●
●● ●
●●● ●
● ●● ●
● ●●● ●●●● ● ●●
●
● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ●
● ●●●● ●●● ●● ●● ● ●●
●
● ●
● ● ● ● ●● ●●●●● ● ●
● ● ● ●●● ● ● ●● ● ● ● ● ●● ●● ● ●● ●
●●●● ● ●
● ● ● ●●● ● ● ● ● ●
● ● ● ●●
●
●● ●●
●
●● ●● ●
●
●
●
●
●
●
●
●
● ●● ●● ●●
●●
● ●
●
●
●
●
●
●
● ●●●●●
● ●
●●●● ● ●● ● ●● ● ● ● ●
● ●● ●●●● ●● ● ● ●●●●●●●
● ●●● ● ●●
●●
● ●
●
●
●
●
●
●
● ●● ●●●
● ●
●●
●● ●●● ● ●●● ● ● ●
●● ● ● ● ● ●● ● ● ●
● ● ● ● ●● ● ●
●● ●● ● ● ●● ● ● ●● ● ● ● ● ●
●●● ●●● ● ● ●● ●
●●● ● ●●●●● ● ● ● ● ●● ● ●●
●●● ● ●
●● ●●
●
● ●● ● ●
●●● ● ●●●●● ● ● ●●● ●●● ● ●●
● ● ●● ● ● ●●● ● ●● ●
●●●
● ●
●● ● ● ● ● ● ● ● ● ●●●●● ●●● ● ●● ● ●● ●●●
●
●●●
●●● ● ● ● ●●
● ● ●
●● ●
●● ●●●●●
● ● ● ● ● ●●
●● ●●
●●●●
● ●●● ●●
● ● ●
●●● ● ●
●●●●● ● ●● ●●●●
●● ●●
●●● ●● ●
●●● ● ●
● ● ●
● ● ● ●●● ●
● ●
●● ●●● ●
● ●● ● ● ● ●● ● ● ● ● ●● ● ●●●●● ●
● ●
●
●● ●●●● ●●●● ● ●
●●
●● ● ● ● ●● ●●
●● ●
●●●
● ● ● ●● ● ●
●● ●
●● ●
●●●
● ● ● ●● ● ●
●● ● ● ●● ●●● ● ● ● ●●●● ●● ● ● ● ●
● ● ● ●● ●●●
● ● ●●● ● ● ●●●● ●● ● ● ● ●
●
● ●●● ●● ●● ● ●
●
●●● ● ● ● ● ●● ●●
● ● ●●● ● ●
● ● ● ●
● ● ● ● ● ●● ●
● ● ●
●● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ●
●● ● ●
● ●
● ●
● ● ● ●
Simple Transformation
84 / 327
Simple Transformation
84 / 327
Simple Transformation
84 / 327
Polynomial Transformation
I Polynomial Model
I y = f (x) + ε = β0 + β1 x + β2 x2 + · · · + βl xl + ε
I In R: Use poly(x,degree) to avoid collinearity
85 / 327
Polynomial Transformation: Collinearity
x <- seq(0, 1, l = 200)
X <- outer(x, 1:5, "^")
X.c <- poly(x, 5)
round(cor(X), 2)
round(cor(X.c), 2)
## 1 2 3 4 5
## 1 1 0 0 0 0
## 2 0 1 0 0 0
## 3 0 0 1 0 0
## 4 0 0 0 1 0
## 5 0 0 0 0 1
●
●●
● ●
2
●●
●●
●●● ● ●
● ●
● ● ●●● ●
● ●● 87 / 327
● ●
Polynomial Transformation: Synthetic example
●
●●
● ●●
2
●
●●
●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ● ● ●
● ● ●
● ● ●● ● ● ●●
● ●● ● ● ●● ●● ●● ●
● ● ●
●● ●● ● ● ● ● ● ● ● ● ●
●● ●● ● ●● ●● ●●● ●● ● ●
●
y
●● ● ●● ● ●
●● ●● ● ● ●
● ● ● ● ●
● ● ●
● ●● ● ● ● ●● ● ●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
●● ● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
●● ● ●
● ●●
● ●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ●
●
−1
● ●● ●● ●
●●● ● ●
● ● ● ● ●
● ●● ●● ● ●
● ●
● ● ●● ●● ●
88 / 327
Polynomial Transformation: Synthetic example
●
true f
degree 3
●
●●
● ●●
2
●
●●
●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ● ● ●
● ● ●
● ● ●● ● ● ●●
● ●● ● ● ●● ●● ●● ●
● ● ●
●● ●● ● ● ● ● ● ● ● ● ●
●● ●● ● ●● ●● ●●● ●● ● ●
●
y
●● ● ●● ● ●
●● ●● ● ● ●
● ● ● ● ●
● ● ●
● ●● ● ● ● ●● ● ●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
●● ● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
●● ● ●
● ●●
● ●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ●
●
−1
● ●● ●● ●
●●● ● ●
● ● ● ● ●
● ●● ●● ● ●
● ●
● ● ●● ●● ●
88 / 327
Polynomial Transformation: Synthetic example
●
true f
degree 3
●
degree 7 ●●
● ●●
2
●
●●
●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ● ● ●
● ● ●
● ● ●● ● ● ●●
● ●● ● ● ●● ●● ●● ●
● ● ●
●● ●● ● ● ● ● ● ● ● ● ●
●● ●● ● ●● ●● ●●● ●● ● ●
●
y
●● ● ●● ● ●
●● ●● ● ● ●
● ● ● ● ●
● ● ●
● ●● ● ● ● ●● ● ●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
●● ● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
●● ● ●
● ●●
● ●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ●
●
−1
● ●● ●● ●
●●● ● ●
● ● ● ● ●
● ●● ●● ● ●
● ●
● ● ●● ●● ●
88 / 327
Polynomial Transformation: Synthetic example
●
true f
degree 3
●
degree 7 ●●
● ●●
2
●
degree 11 ●●
●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ● ● ●
● ● ●
● ● ●● ● ● ●●
● ●● ● ● ●● ●● ●● ●
● ● ●
●● ●● ● ● ● ● ● ● ● ● ●
●● ●● ● ●● ●● ●●● ●● ● ●
●
y
●● ● ●● ● ●
●● ●● ● ● ●
● ● ● ● ●
● ● ●
● ●● ● ● ● ●● ● ●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
●● ● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
●● ● ●
● ●●
● ●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ●
●
−1
● ●● ●● ●
●●● ● ●
● ● ● ● ●
● ●● ●● ● ●
● ●
● ● ●● ●● ●
88 / 327
Polynomial Transformation: Synthetic example
●
true f
degree 3
●
degree 7 ●●
● ●●
2
●
degree 11 ●●
degree 15 ●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ● ● ●
● ● ●
● ● ●● ● ● ●●
● ●● ● ● ●● ●● ●● ●
● ● ●
●● ●● ● ● ● ● ● ● ● ● ●
●● ●● ● ●● ●● ●●● ●● ● ●
●
y
●● ● ●● ● ●
●● ●● ● ● ●
● ● ● ● ●
● ● ●
● ●● ● ● ● ●● ● ●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
●● ● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
●● ● ●
● ●●
● ●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ●
●
−1
● ●● ●● ●
●●● ● ●
● ● ● ● ●
● ●● ●● ● ●
● ●
● ● ●● ●● ●
88 / 327
Piecewise Polynomials
89 / 327
Piecewise Polynomials
89 / 327
Piecewise Polynomials
Piecewise Polynomials
●
true f
degree 15
●
5 piecewise ●●
● ●●
2
●
quadratic polynomials ●●
●● ● ●
●
● ●
● ● ●●● ●
● ●●●
● ● ●
● ●● ● ● ●●
● ● ● ●
●
● ● ● ●● ● ●●
● ● ●
● ● ● ● ●● ● ●●● ●
1
● ● ●
● ● ●
● ● ●●●
● ● ● ●
●● ●
● ●● ●●●● ● ●●● ● ● ●●●● ●
●● ●● ● ● ● ● ● ●
●● ●● ● ●● ●
● ● ● ●● ●●
y
●● ● ●● ● ●
●● ●● ● ● ● ●
● ● ● ●
● ● ●
● ●● ● ● ● ● ●●
●
● ● ● ● ● ●●
● ● ●
● ●● ● ● ●●
0
● ● ●● ● ● ● ●
● ●● ● ●●●
● ● ●● ●●●
●● ● ● ● ●
● ● ● ●● ●●● ●
●● ●
● ● ● ● ● ● ●●
● ●●
●
●
●●●●● ● ●
● ●●
●●
●● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ●● ●● ● ●
−1
● ●● ●● ●
●●● ● ●
● ● ●● ● ● ●
● ● ● ●● ●
● ● ● ●● ●● ●
91 / 327
Definition: Polynomial Splines
91 / 327
Definition: Polynomial Splines
91 / 327
Definition: Polynomial Splines
91 / 327
Polynomial Splines: Example
polynomial spline degree 0 polynomial spline degree 1
● ●
2
● ●● ● ●●
● ●
●● ●●
●● ● ●
● ●● ● ●
●
● ● ● ●
● ● ●●● ● ● ● ●●● ●
● ● ●●● ● ● ● ●●● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ●● ● ● ●● ● ●●● ● ● ● ●● ● ● ●● ● ●●● ●
● ● ● ●●● ●● ● ● ● ●●● ●●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ●● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ●
● ● ●● ● ● ●● ● ● ●● ● ● ●●
● ●
0
0
● ●● ● ● ●●
● ● ●● ● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ● ●
● ●
●● ●●● ● ● ●● ● ●●● ●● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●●●
● ● ● ● ●● ● ● ●●●
● ● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ●● ●● ● ● ● ● ● ●● ●● ●
−1
−1
● ●
● ●
●●● ● ● ●● ●● ● ● ●
● ● ●
●●● ● ● ●● ●● ● ● ●
●
● ● ●● ● ● ● ●● ●
●● ● ● ●● ● ●
● ● ● ● ● ● ● ● ● ●
●● ●● ● ● ●● ● ●● ●● ● ● ●● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
● ●
2
● ●● ● ●●
● ●
●● ●●
●● ● ●
● ●● ● ●
●
● ● ● ●
● ● ●●● ● ● ● ●●● ●
● ● ●●● ● ● ● ●●● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ●● ● ● ●● ● ●●● ● ● ● ●● ● ● ●● ● ●●● ●
● ● ● ●●● ●● ● ● ● ●●● ●●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ●
●● ● ● ● ● ●● ● ● ● ●
●●●
● ●● ●● ● ● ● ●● ● ● ●●●
● ●● ●● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ● ●
0
●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
0 ●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
● ● ●●● ● ● ●● ● ●●● ● ● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●
●● ●
● ● ● ●● ● ● ●
●● ●
● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
−1
−1
● ● ● ● ●● ●● ●● ● ● ● ● ● ● ●● ●● ●● ● ●
● ● ● ●●● ● ● ● ● ● ● ●●● ● ● ●
●●● ● ●● ● ●●● ● ●● ●
● ● ●● ● ● ● ● ● ●● ● ● ●
● ●● ● ● ● ● ● ●● ● ● ● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
92 / 327
Polynomial Splines: Example
polynomial spline degree 0 polynomial spline degree 1
● ●
2
● ●● ● ●●
● ●
●● ●●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
● ●●● ● ● ●●● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ●● ● ● ●● ● ●●● ● ● ● ●● ● ● ●● ● ●●● ●
● ● ● ●●● ●● ● ● ● ●●● ●●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ●● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ●
● ● ●● ● ● ●● ● ● ●● ● ● ●●
● ●
0
0
● ●● ● ● ●●
● ● ●● ● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ● ●
● ●
●● ●●● ● ● ●● ● ●●● ●● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●●●
● ● ● ● ●● ● ● ●●●
● ● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ●● ●● ● ● ● ● ● ●● ●● ●
−1
−1
● ●
● ●
●●● ● ● ●● ●● ● ● ●
● ● ●
●●● ● ● ●● ●● ● ● ●
●
● ● ●● ● ● ● ●● ●
●● ● ● ●● ● ●
● ● ● ● ● ● ● ● ● ●
●● ●● ● ● ●● ● ●● ●● ● ● ●● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
● ●
2
● ●● ● ●●
● ●
●● ●●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
● ●●● ● ● ●●● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ●● ● ● ●● ● ●●● ● ● ● ●● ● ● ●● ● ●●● ●
● ● ● ●●● ●● ● ● ● ●●● ●●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ●
●● ● ● ● ● ●● ● ● ● ●
●●●
● ●● ●● ● ● ● ●● ● ● ●●●
● ●● ●● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ● ●
0
●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
0 ●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
● ● ●●● ● ● ●● ● ●●● ● ● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●
●● ●
● ● ● ●● ● ● ●
●● ●
● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
−1
−1
● ● ● ● ●● ●● ●● ● ● ● ● ● ● ●● ●● ●● ● ●
● ● ● ●●● ● ● ● ● ● ● ●●● ● ● ●
●●● ● ●● ● ●●● ● ●● ●
● ● ●● ● ● ● ● ● ●● ● ● ●
● ●● ● ● ● ● ● ●● ● ● ● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
92 / 327
Polynomial Splines: Example
polynomial spline degree 0 polynomial spline degree 1
● ●
2
● ●● ● ●●
● ●
●● ●●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
● ●●● ● ● ●●● ●
● ● ● ●
● ●
●
50+2 knots ●●
●
●
● ● ●●
●
●
●
● ●●● ●●
●●
●●● ● ● ●
●
50+2 knots ●●
●
●
● ● ●●
●
●
●
● ●●● ●●
●●
●●● ●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ●● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ●
● ● ●● ● ● ●● ● ● ●● ● ● ●●
● ●
0
0
● ●● ● ● ●●
● ● ●● ● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ● ●
● ●
●● ●●● ● ● ●● ● ●●● ●● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●●●
● ● ● ● ●● ● ● ●●●
● ● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ●● ●● ● ● ● ● ● ●● ●● ●
−1
−1
● ●
● ●
●●● ● ● ●● ●● ● ● ●
● ● ●
●●● ● ● ●● ●● ● ● ●
●
● ● ●● ● ● ● ●● ●
●● ● ● ●● ● ●
● ● ● ● ● ● ● ● ● ●
●● ●● ● ● ●● ● ●● ●● ● ● ●● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
● ●
2
● ●● ● ●●
● ●
●● ●●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
20+2 knots ●
●● ● ●
●
●
● ●
● ●●● ●
● ●●● ● ● ●●● ●
● ● ● ●
● ●
●
50+2 knots ●●
●
●
● ● ●●
●
●
●
● ●●● ●●
●●
●●● ● ● ●
●
50+2 knots ●●
●
●
● ● ●●
●
●
●
● ●●● ●●
●●
●●● ●
1
1
● ● ● ●● ● ● ● ● ● ● ●● ● ● ●
● ● ●● ●●●
●
● ● ●● ● ● ● ● ●● ●●●
●
● ● ●● ● ●
● ●● ●● ●●●● ● ● ● ● ●● ●● ●●●● ● ● ●
● ● ●● ● ● ●●●● ● ● ● ●● ● ● ●●●● ●
●●●●● ● ● ● ●● ●● ●●● ●● ● ●●●●● ● ● ● ●● ●● ●●● ●● ●
● ● ● ● ● ● ● ● ● ●
y
y
●● ●● ● ● ●● ● ● ●● ●● ● ● ●● ● ●
● ●
●● ● ● ● ● ●● ● ● ● ●
●●●
● ●● ●● ● ● ● ●● ● ● ●●●
● ●● ●● ● ● ● ●● ● ●
● ● ● ● ● ●● ● ● ● ● ● ●●
● ● ● ●
0
●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
0 ●
● ● ●● ●
●
● ● ● ● ●
● ●●
●
● ● ●●● ● ● ●● ● ●●● ● ● ●●● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ●● ●●● ● ● ● ●● ●●● ●
●
●●●● ● ● ● ● ●● ● ● ●
●●●● ● ● ● ● ●● ● ●
● ● ●
●● ●
● ● ● ●● ● ● ●
●● ●
● ● ● ●●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
−1
−1
● ● ● ● ●● ●● ●● ● ● ● ● ● ● ●● ●● ●● ● ●
● ● ● ●●● ● ● ● ● ● ● ●●● ● ● ●
●●● ● ●● ● ●●● ● ●● ●
● ● ●● ● ● ● ● ● ●● ● ● ●
● ●● ● ● ● ● ● ●● ● ● ● ●
● ● ● ● ●●● ● ● ● ● ●●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
92 / 327
Polynomial Splines: Discussion
93 / 327
Polynomial Splines: Discussion
93 / 327
Polynomial Splines: Discussion
93 / 327
Truncated Polynomials
94 / 327
Truncated Polynomials
94 / 327
Truncated Polynomials: Example
basis functions
●
●●
2
●
●● ●
●
●
●
●● ●
●
● ●
● ● ●●● ●
● ●●
● ● ● ●
● ●● ● ● ●●
● ●
● ● ● ●● ● ●●●
● ● ● ● ●
● ● ●● ●●
1
● ● ● ●
● ● ● ●
● ●● ● ●● ●
● ●
●● ● ●●
● ●●
●● ● ●● ● ● ● ● ● ●●
● ● ● ● ● ●
●● ●● ● ● ● ●
●● ●● ● ● ●● ● ● ●●
● ●
●
y
● ● ● ●● ● ●
● ● ● ●
●● ●
● ● ● ● ● ● ●
●●● ● ● ● ● ● ●
● ● ●
● ● ● ● ●●
● ● ●
0
● ●● ●●
●● ● ● ●
●
●
●● ● ● ●● ● ●●●
● ●●
● ●
● ● ● ● ● ●
● ● ● ● ●● ●
● ●● ●
●●● ● ● ●
● ● ● ●●
●● ● ●●
● ●
●● ● ●
●
● ●● ●●
●● ● ●
● ● ●
● ● ● ●
● ●●● ● ● ●
● ● ● ●● ●● ●
−1
● ●
● ●● ● ●
●
● ●
● ● ● ● ●
● ● ●●
● ●● ● ● ●
● ●
● ● ●● ●
●●
95 / 327
Truncated Polynomials: Example
● ●
● ●
●● ●●
2
2
● ●
●● ● ●● ●
● ●
● ●
● ●
●● ●
● ●● ●
●
● ● ● ●
● ● ●●● ● ● ● ●●● ●
● ●● ● ●●
● ● ● ● ● ● ● ●
● ●● ● ● ●● ● ●● ● ● ●●
● ● ● ●
● ● ● ●● ● ●●● ● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ●
● ● ●● ●● ● ● ●● ●●
1
1
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●● ● ●● ●
● ● ● ●● ● ●● ●
● ●
●● ● ●● ●● ● ●●
● ●● ● ●●
●● ● ●● ● ● ● ● ● ●● ●● ● ●● ● ● ● ● ● ●●
● ● ● ● ● ● ● ● ● ● ● ●
●● ●● ● ● ● ● ●● ●● ● ● ● ●
●● ●● ● ● ●● ● ● ●● ●● ●● ● ● ●● ● ● ●●
● ●
● ● ●
●
y
y
● ● ● ●● ● ● ● ● ● ●● ● ●
● ● ● ● ● ● ● ●
●● ● ●● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●
●●● ● ● ● ● ● ● ●●● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ●●
● ● ● ● ● ●
0
0
● ●● ●● ● ●● ●●
●● ● ● ●
●
●● ● ● ●
●
● ●
●● ● ● ●● ● ●●● ●● ● ● ●● ● ●●●
● ●● ● ●●
● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ● ●● ●
● ●● ● ● ●● ●
●●● ● ● ● ●●● ● ● ●
● ● ● ●● ● ● ● ●●
●● ● ●● ●● ● ●●
● ● ● ●
●● ● ● ●● ● ●
● ●
● ●● ●● ● ●● ●●
●● ● ● ●● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●●● ● ● ● ● ●●● ● ● ●
● ● ● ●● ●● ● ● ● ● ●● ●● ●
−1
−1
● ● ● ●
● ●● ● ● ● ●● ● ●
●
● ● ●
● ●
● ● ● ● ● ● ● ● ● ●
● ● ●● ● ● ●●
● ●● ● ● ● ● ●● ● ● ●
● ● ● ●
● ● ●● ● ● ● ●● ●
●● ●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
95 / 327
Truncated Polynomials: Example
● ●
●● ●●
2
2
● ●
●● ● ●● ●
● ●
● ●
● ●
●● ●
● ●● ●
●
● ● ● ●
● ● ●●● ● ● ● ●●● ●
● ●● ● ●●
● ● ● ● ● ● ● ●
● ●● ● ● ●● ● ●● ● ● ●●
● ● ● ●
● ● ● ●● ● ●●● ● ● ● ●● ● ●●●
● ● ● ● ● ● ● ● ● ●
● ● ●● ●● ● ● ●● ●●
1
1
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●● ● ●● ●
● ● ● ●● ● ●● ●
● ●
●● ● ●● ●● ● ●●
● ●● ● ●●
●● ● ●● ● ● ● ● ● ●● ●● ● ●● ● ● ● ● ● ●●
● ● ● ● ● ● ● ● ● ● ● ●
●● ●● ● ● ● ● ●● ●● ● ● ● ●
●● ●● ● ● ●● ● ● ●● ●● ●● ● ● ●● ● ● ●●
● ●
● ● ●
●
y
y
● ● ● ●● ● ● ● ● ● ●● ● ●
● ● ● ● ● ● ● ●
●● ● ●● ●
● ● ● ● ● ● ● ● ● ● ● ● ● ●
●●● ● ● ● ● ● ● ●●● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ●●
● ● ● ● ● ●
0
0
● ●● ●● ● ●● ●●
●● ● ● ●
●
●● ● ● ●
●
● ●
●● ● ● ●● ● ●●● ●● ● ● ●● ● ●●●
● ●● ● ●●
● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ●● ● ● ● ● ● ●● ●
● ●● ● ● ●● ●
●●● ● ● ● ●●● ● ● ●
● ● ● ●● ● ● ● ●●
●● ● ●● ●● ● ●●
● ● ● ●
●● ● ● ●● ● ●
● ●
● ●● ●● ● ●● ●●
●● ● ● ●● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●●● ● ● ● ● ●●● ● ● ●
● ● ● ●● ●● ● ● ● ● ●● ●● ●
−1
−1
● ● ● ●
● ●● ● ● ● ●● ● ●
●
● ● ●
● ●
● ● ● ● ● ● ● ● ● ●
● ● ●● ● ● ●●
● ●● ● ● ● ● ●● ● ● ●
● ● ● ●
● ● ●● ● ● ● ●● ●
●● ●●
● ●
0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
x x
95 / 327
Truncated Polynomials: Discussion
Numerical disadvantages
I Basis function values can become very large
I strong colinearity of basis functions
⇒ numerically preferable: B-spline-basis functions
96 / 327
Truncated Polynomials: Discussion
Numerical disadvantages
I Basis function values can become very large
I strong colinearity of basis functions
⇒ numerically preferable: B-spline-basis functions
96 / 327
B-splines: Idea
97 / 327
B-splines: Idea
97 / 327
B-Splines: Basis Functions
B−spline basis functions
1.0
degree l=0
0.8
0.6
B(x)
0.4
0.2
0.0
κ1 κ2 κ3 κ4 κ5 κ6 κ7 κ8 κ9 κ10 κ11
98 / 327
B-Splines: Basis Functions
B−spline basis functions
1.0
degree l=0
degree l=1
0.8
0.6
B(x)
0.4
0.2
0.0
κ1 κ2 κ3 κ4 κ5 κ6 κ7 κ8 κ9 κ10 κ11
98 / 327
B-Splines: Basis Functions
B−spline basis functions
1.0
degree l=0
degree l=1
degree l=2
0.8
0.6
B(x)
0.4
0.2
0.0
κ1 κ2 κ3 κ4 κ5 κ6 κ7 κ8 κ9 κ10 κ11
98 / 327
B-Splines: Basis Functions
B−spline basis functions
1.0
degree l=0
degree l=1
degree l=2
degree l=3
0.8
0.6
B(x)
0.4
0.2
0.0
κ1 κ2 κ3 κ4 κ5 κ6 κ7 κ8 κ9 κ10 κ11
98 / 327
B-Splines: Basis Functions
B−spline basis functions
1.0
0.8
0.6
B(x)
0.4
0.2
0.0
κ1 κ2 κ3 κ4 κ5 κ6 κ7 κ8 κ9 κ10 κ11
98 / 327
B-Splines: Properties
99 / 327
B-Splines: Properties
99 / 327
B-Splines: Properties
99 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
(B-)Splines as Linear Models
Model: y = f (x) + ε
How to estimate f (x)?
Idefine basis functions bk (x); k = 1, . . . , K
PK
I f (x) ≈
k=1 θk bk (x)
⇒ ŷ = f (x) = K
ˆ
P
k=1 θ̂k bk (x)
⇒ this is a linear model ŷ =Bθ̂
b1 (x1 ) . . . bK (x1 )
.. ..
with design matrix B = . .
b1 (xn ) . . . bK (xn )
I analogously applicable to GLMs: g (µ̂) = Bθ̂
100 / 327
B-Splines: R-Implementation
bs in splines package creates a B-spline Designmatrix B:
library("splines")
B <- bs(x, df = 12, intercept = T)
m_bspline <- lm(y ~ B - 1)
B_scaled <- t(t(B) * coef(m_bspline))
plot(x, y, pch = 19, cex = .5, col = "grey")
matlines(x, B, lty = 1, col = 1, lwd = 2)
●
●●
2
●
● ●●
● ●
● ●
●● ●
● ●
● ● ● ● ● ●
● ● ●
● ● ● ●
● ●● ● ● ●●
● ● ● ● ● ●●● ●
● ● ● ●
● ● ●
● ● ● ●●
1
● ● ● ● ● ●
● ● ● ●●● ● ●● ●
●● ●
● ● ● ●
● ● ● ●● ● ● ●● ● ● ● ● ●
● ● ● ● ● ●
●● ●● ● ● ● ● ●
● ● ● ● ● ● ● ●● ● ● ●● ●●
y
● ● ● ● ● ● ●
● ● ●● ● ● ●
● ● ● ●
●
● ● ● ●
●
●● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
0
● ● ● ●● ●● ●
● ● ●● ● ● ● ●
● ● ● ● ●
● ● ● ●● ●
●
●
● ● ●
● ● ● ● ● ● ●● ●● ● ●
● ●● ● ● ●
● ● ● ●● ●
● ● ●● ● ●● ●
●
● ● ● ●● ● ●
● ● ● ● ●
● ● ● ●
●● ●● ● ● ● ●● ●●
●
−1
● ● ● ● ●
● ● ● ● ● ● ● ●
●● ●●
●● ● ● ●
● ●● ● ● ●● ● ●
● ● ● ●
● ● ● ●
x
B-Splines: R-Implementation
library("splines")
B <- bs(x, df = 12, intercept = T)
m_bspline <- lm(y ~ B - 1)
B_scaled <- t(t(B) * coef(m_bspline))
plot(x, y, pch = 19, cex = .5, col = "grey")
matlines(x, B, lty = 1, col = scales::alpha(1, .7), lwd = .5)
matlines(x, B_scaled, lty = 1, col = 2, lwd = 2)
●
●●
2
●
● ●●
● ●
● ●
●● ●
● ●
● ● ● ● ● ●
● ● ●
● ● ● ●
● ●● ● ● ●●
● ● ● ● ● ●●● ●
● ● ● ●
● ● ●
● ● ● ●●
1
● ● ● ● ● ●
● ● ● ●●● ● ●● ●
●● ●
● ● ● ●
● ● ● ●● ● ● ●● ● ● ● ● ●
● ● ● ● ● ●
●● ●● ● ● ● ● ●
● ● ● ● ● ● ● ●● ● ● ●● ●●
y
● ● ● ● ● ● ●
● ● ●● ● ● ●
● ● ● ●
●
● ● ● ●
●
●● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
0
● ● ● ●● ●● ●
● ● ●● ● ● ●
● ● ●● ● ● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ● ●● ●● ● ●
● ●● ● ● ●
● ● ● ●● ●
● ● ●● ● ●● ●
●
● ● ● ●● ● ●
● ● ● ● ●
● ● ● ●
●● ●● ● ● ● ●● ●●
●
−1
● ● ● ● ●
● ● ● ● ● ● ● ●
●● ●●
●● ● ● ●
● ●● ● ● ●● ● ●
● ● ● ●
● ● ● ●
x
B-Splines: R-Implementation
library("splines")
B <- bs(x, df = 12, intercept = T)
m_bspline <- lm(y ~ B - 1)
B_scaled <- t(t(B) * coef(m_bspline))
plot(x, y, pch = 19, cex = .5, col = "grey")
matlines(x, B, lty = 1, col = scales::alpha(1, .7), lwd = .5)
matlines(x, B_scaled, lty = 1, col = scales::alpha(2, .7), lwd = 1)
lines(x, fitted(m_bspline), lty = 1, col = 3, lwd = 2)
●
●●
2
●
● ●●
● ●
● ●
●● ●
● ●
● ● ● ● ● ●
● ● ●
● ● ● ●
● ●● ● ● ●●
● ● ● ● ● ●●● ●
● ● ● ●
● ● ●
● ● ● ●●
1
● ● ● ● ● ●
● ● ● ●●● ● ●● ●
●● ●
● ● ● ●
● ● ● ●● ● ● ●● ● ● ● ● ●
● ● ● ● ● ●
●● ●● ● ● ● ● ●
● ● ● ● ● ● ● ●● ● ● ●● ●●
y
● ● ● ● ● ● ●
● ● ●● ● ● ●
● ● ● ●
●
● ● ● ●
●
●● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
0
● ● ● ●● ●● ●
● ● ●● ● ● ●
● ● ●● ● ● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ● ●● ●● ● ●
● ●● ● ● ●
● ● ● ●● ●
● ● ●● ● ●● ●
●
● ● ● ●● ● ●
● ● ● ● ●
● ● ● ●
●● ●● ● ● ● ●● ●●
●
−1
● ● ● ● ●
● ● ● ● ● ● ● ●
●● ●●
●● ● ● ●
● ●● ● ● ●● ● ●
● ● ● ●
● ● ● ●
x
Splines: Summary
104 / 327
Recap: Linear Models
105 / 327
Example: Sleep Deprivation Data
105 / 327
Example: Sleep Deprivation Data
106 / 327
Example: Sleep Deprivation Data
● ●
● ● ● ● ● ● ●
● ● ●
300 ● ● ●
●
● ● ●
●
● ● ●
●
● ● ●
● ● ● ●
●
●
● ● ● ● ● ● ● ● ●
●
● ● ● ● ● ● ●
200 ● ●
● ● ● ● ● ●
● ● ●
● ●
300 ● ● ●
● ●
● ●
● ●
●
● ●
●
● ●
● ●
●
● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
200
351 352 369 370 371 372
400 ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ●
● ●
300 ●
●
● ● ●
●
●
●
●
● ●
●
●
●
●
● ● ● ● ● ●
●
●
●
● ●
● ● ●
● ●
● ● ●
200
1 4 7 1 4 7 1 4 7 1 4 7 1 4 7 1 4 7
Days of sleep deprivation
Example: Sleep Deprivation Data
Model global trend: Reactionij ≈ β0 + β1 Daysij
##
## Call:
## lm(formula = Reaction ~ Days, data = sleepstudy)
##
## Residuals:
## Min 1Q Median 3Q Max
## -110.848 -27.483 1.546 26.142 139.953
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 251.405 6.610 38.033 < 2e-16 ***
## Days 10.467 1.238 8.454 9.89e-15 ***
## ---
## Signif. codes:
## 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
##
## Residual standard error: 47.71 on 178 degrees of freedom
## Multiple R-squared: 0.2865, Adjusted R-squared: 0.2825
## F-statistic: 71.46 on 1 and 178 DF, p-value: 9.894e-15
Example: Sleep Deprivation Data
With estimated global level and trend added:
308 309 310 330 331 332
● ●
●
●
400 ●
●
●
●
Average reaction time [ms]
● ●
● ● ● ● ● ● ●
● ● ●
300 ● ● ●
●
● ● ●
●
● ● ●
●
● ● ●
● ● ● ●
●
●
● ● ● ● ● ● ● ● ●
●
● ● ● ● ● ● ●
200 ● ●
● ● ● ● ● ●
● ● ●
● ●
300 ● ● ●
● ●
● ●
● ●
●
● ●
●
● ●
● ●
●
● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
200
351 352 369 370 371 372
400 ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ●
● ●
300 ●
●
● ● ●
●
●
●
●
● ●
●
●
●
●
● ● ● ● ● ●
●
●
●
● ●
● ● ●
● ●
● ● ●
200
1 4 7 1 4 7 1 4 7 1 4 7 1 4 7 1 4 7
Days of sleep deprivation
⇒ obviously inappropriate model
Example: Sleep Deprivation Data
● ● ●
● ● ● ● ● ●
● ● ● ● ●
300 ● ● ●
●
● ● ●
●
● ● ● ● ● ● ● ● ● ● ●
●
●
● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
200 ● ●
●
●
●
●
● ● ●
● ●
●
● ● ● ●
●
● ● ● ● ●
● ● ● ● ● ●
200
● ● ● ● ●
200
0.02.55.07.5 0.02.55.07.5 0.02.55.07.5 0.02.55.07.5 0.02.55.07.5 0.02.55.07.5
Days of sleep deprivation
⇒ better fit
Outline
Recap: Linear Models
112 / 327
Motivation: From LM to LMM
112 / 327
Motivation: From LM to LMM
yij = β̄0 + (β0i − β̄0 ) + β̄1 x1ij + (β1i − β̄1 )x1ij + εij
113 / 327
Motivation: From LM to LMM
I idea of a random effect model
I β̄ is the population level effect β.
I express subject-specific deviations βi − β̄ as Gaussian random variables
bi ∼ N(0, σb2 ).
I this yields
yij = β0 + β1 x1ij + b0i + b1i x1ij + εij
with
εij ∼ N(0, σ 2 ), (b0i , b1i )> ∼ N2 (0, Σ).
I or alternatively:
yij = b0i + b1i x1ij + εij
with
εij ∼ N(0, σ 2 ), (b0i , b1i )> ∼ N2 (β0 , β1 )> , Σ .
114 / 327
Outline
Recap: Linear Models
115 / 327
Advantages of the Random Effects Approach
I decomposition of random variability in data into
I subject-specific deviations from population mean
I deviation of observations from subject means
⇒ more precise estimates of population trends
I some degree of protection against bias caused by drop-out
I random effects serve as surrogates for effects of unobserved
subject-level covariates
⇒ control for unobserved heterogeneity
I distributional assumption bi ∼ N stabilizes estimates b̂i (shrinkage
effect) compared to fixed subject-specific estimates β̂i without
distributional assumption
I intuition: estimates are stabilized by including prior knowledge in the
model, i.e., assuming that subjects from the population are mostly
similar to each other
116 / 327
Advantages of the Random Effects Approach
yij = β0 + bi + εij
i.i.d. i.i.d.
with bi ∼ N(0, σb2 ); εij ∼ N(0, σε2 )
Cov(bi , bi ) σ2
=⇒ Corr(yij , yij 0 ) = p = 2 b 2.
Var(yij ) Var(yij 0 ) σb + σε
Corr(yij , yi 0 j ) = 0 for i 6= j.
117 / 327
Advantages of the Random Effects Approach
I random effects model the correlation structure between observations:
Corr(yij , yi 0 j ) = 0 for i 6= j.
117 / 327
Advantages of the Random Effects Approach
Corr(yij , yi 0 j ) = 0 for i 6= j.
117 / 327
Outline
Recap: Linear Models
y = Xβ + Ub + ε
b ∼ N(0, G)
ε ∼ N(0, R)
118 / 327
Conditional and Marginal Perspective
Conditional perspective:
Interpretation:
random effects b are subject-specific effects that vary across the
population.
Hierarchical formulation:
expected response is a function of population-level effects (fixed effects)
and subject-level effects (random effects).
119 / 327
Conditional and Marginal Perspective
Marginal perspective:
Interpretation:
random effects b induce a correlation structure in y defined by U and G,
and thereby allow valid analyses of correlated data.
Marginal formulation:
model is concerned with the marginal expectation of y averaged over the
population as a function of population-level effects.
120 / 327
Linear Mixed Model for Longitudinal Data
For subjects i = 1, . . . , m, each with observations j = 1, . . . , ni :
with
Pm
I y = (y> > >
1 , y2 , . . . , ym ) (n = i=1 ni entries)
I > > >
ε = (ε1 , ε2 , . . . , εm ) (n entries)
I β = (β0 , β1 , . . . , βp )>
I X = [1 x1 . . . xp ]
I b = (b1 , b2 , . . . , bm ) of length mq, with b ∼ Nmq (0, G)
I G = diag(Σ, . . . , Σ))
I U = diag(U1 , . . . , Um ) with dimension n × mq
I Ui = 1 u1i . . . u(q−1)i with dimension ni × q. Variables in Ui are
typically a subset of those in X.
121 / 327
Other Types of Mixed Models
I hierarchical/multi-level model:
e.g., test score yijk of a pupil i in class j in school k:
yijk = β0 + x>
ijk β + b1j + b2k + εijk
with random intercepts for class (b1j ∼ N(0, σ12 )) and school
(b2k ∼ N(0, σ22 ))
I crossed designs:
e.g., score yij of a subject i on an item j:
yij = β0 + x>
ij β + b1i + b2j + εijk
with random intercepts for subject (b1i ∼ N(0, σ12 ), subject ability)
and item (b2j ∼ N(0, σ22 ), item difficulty)
122 / 327
Outline
Recap: Linear Models
y ∼ N(Xβ, V(ϑ))
1n o
l(β, ϑ) = − log |V(ϑ)| + (y − Xβ)> V(ϑ)−1 (y − Xβ)
2
−1
β(ϑ)
b = arg max (l(β, ϑ)) = X> V(ϑ)−1 X X> V(ϑ)−1 y
β
1n >
o
lP (ϑ) = − log |V(ϑ)| + (y − Xβ(ϑ))
b V(ϑ)−1 (y − Xβ(ϑ))
b
2
→ max
ϑ
124 / 327
Outline
Recap: Linear Models
125 / 327
Generalized Linear Mixed Models
Model:
126 / 327
Caveat: Effect Attenuation in GLMMs
LMM Logit−GLMM
1.00
4
0.75
h(xiβ + b0 i)
0
0.50
−4 0.25
−8 0.00
−2 −1 0 1 2 −2 −1 0 1 2
x
1
For random intercept logit-models: βmar ≈ √ βcond
1+0.346σb2
127 / 327
Outline
Recap: Linear Models
is the density of
For GLMMs:
n
Z !
Y
L(β, ϑ, φ) = f (yi |β, φ, b, ϑ) f (b|ϑ)db
i=1
(...sucks)
128 / 327
GLMM Estimation Algorithms
129 / 327
GLMM Estimation Algorithms
129 / 327
GLMM Estimation Algorithms
129 / 327
GLMM Estimation Algorithms
129 / 327
Mixed Models in a Nutshell
I standard regression models can model only the structure of the
expected values of the response
I mixed models are regression models in which a subset of coefficients
are assumed to be random unknown quantities from a known
distribution instead of fixed unknowns, and this means we can
I model the covariance structure of the data (marginal perspective)
I estimate (a large number of) subject-level coefficients without too
much trouble (conditional perspective)
I random intercepts can be used to model subject-specific differences in
the level of the response
→ grouping variable as a special kind of nominal covariate
I a random slope for a covariate is like an interaction between the
grouping variable and that covariate
→ grouping variable as a special kind of effect modifier for that
covariate
I hard estimation problems: variance components difficult to optimize,
often very high-dim. b
130 / 327
Mixed Models in a Nutshell
I standard regression models can model only the structure of the
expected values of the response
I mixed models are regression models in which a subset of coefficients
are assumed to be random unknown quantities from a known
distribution instead of fixed unknowns, and this means we can
I model the covariance structure of the data (marginal perspective)
I estimate (a large number of) subject-level coefficients without too
much trouble (conditional perspective)
I random intercepts can be used to model subject-specific differences in
the level of the response
→ grouping variable as a special kind of nominal covariate
I a random slope for a covariate is like an interaction between the
grouping variable and that covariate
→ grouping variable as a special kind of effect modifier for that
covariate
I hard estimation problems: variance components difficult to optimize,
often very high-dim. b
130 / 327
Mixed Models in a Nutshell
I standard regression models can model only the structure of the
expected values of the response
I mixed models are regression models in which a subset of coefficients
are assumed to be random unknown quantities from a known
distribution instead of fixed unknowns, and this means we can
I model the covariance structure of the data (marginal perspective)
I estimate (a large number of) subject-level coefficients without too
much trouble (conditional perspective)
I random intercepts can be used to model subject-specific differences in
the level of the response
→ grouping variable as a special kind of nominal covariate
I a random slope for a covariate is like an interaction between the
grouping variable and that covariate
→ grouping variable as a special kind of effect modifier for that
covariate
I hard estimation problems: variance components difficult to optimize,
often very high-dim. b
130 / 327
Recap: Linear Models
131 / 327
Splines
I Splines
I piecewise polynomials with smoothness properties at knot locations
I can be embedded into (generalized) linear models (e.g. ML estimates)
I Problem: choice of optimal knot setting.
I Two-fold problem:
I how many knots?
I where to put them?
I two possible solutions, one of them good:
I adaptive knot choice: make no. of knots and their positioning part of
optimization procedure
I penalization: use large number of knots to guarantee sufficient model
capacity, but add a cost (penalty) for wiggliness / complexity to
optimization procedure
131 / 327
Splines
I Splines
I piecewise polynomials with smoothness properties at knot locations
I can be embedded into (generalized) linear models (e.g. ML estimates)
I Problem: choice of optimal knot setting.
I Two-fold problem:
I how many knots?
I where to put them?
I two possible solutions, one of them good:
I adaptive knot choice: make no. of knots and their positioning part of
optimization procedure
I penalization: use large number of knots to guarantee sufficient model
capacity, but add a cost (penalty) for wiggliness / complexity to
optimization procedure
131 / 327
Splines
I Splines
I piecewise polynomials with smoothness properties at knot locations
I can be embedded into (generalized) linear models (e.g. ML estimates)
I Problem: choice of optimal knot setting.
I Two-fold problem:
I how many knots?
I where to put them?
I two possible solutions, one of them good:
I adaptive knot choice: make no. of knots and their positioning part of
optimization procedure
I penalization: use large number of knots to guarantee sufficient model
capacity, but add a cost (penalty) for wiggliness / complexity to
optimization procedure
131 / 327
Function estimation example: climate reconstruction
●
●
0.5
●
0.0
● ● ●
●
● ●
●
● ●
●
●
●
● ●
● ● ●
●
●
●
●
●
● ●
● ●
● ●
●
●
●
●
● ●
● ● ●
●
● ● ●
● ●
●
●
●
● ●
●
● ● ●
● ●
●
● ●
●
● ● ●
● ●
● ● ●
● ● ●
● ● ●
●
●
●
● ● ●
●
●
● ● ●
● ● ●
● ● ●
● ● ●
● ●
● ●
●
●
● ● ●
● ●
● ● ● ●
● ● ● ●
● ● ● ●
● ●
● ● ●
● ●
● ● ●
●
● ● ●
● ● ●
● ●
● ● ● ●
● ●
● ● ●
● ● ●
● ●
● ●
● ●
● ●
● ●
● ●
● ● ●
● ● ● ●
● ● ● ●
● ● ● ●
●
● ● ● ● ● ●
● ● ● ●
● ● ●
● ●
● ● ● ●
● ● ● ● ● ● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ●
● ● ● ● ● ● ● ●
●
● ● ● ●
● ● ● ● ●
● ● ● ●
● ●●
● ● ● ●
●
● ●●
● ● ●
● ●
● ● ● ●
● ●
● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ●
● ●● ● ●
● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
● ● ●
● ● ●● ●
● ● ● ● ● ● ●
● ● ●
● ● ● ● ●
● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ●
● ● ● ● ● ●
● ● ●
● ● ● ● ● ●
● ● ●
● ● ●
● ● ●
● ● ● ● ● ● ●
●
● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
● ● ● ● ● ● ●
● ● ●
● ● ● ● ●● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ●● ●
● ●
● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●
● ● ● ● ● ●● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ●
● ● ● ●●● ● ● ● ● ●
●
● ●
●
● ●● ●
● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ●
● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ●
● ●
● ● ● ● ● ●
● ● ● ●
●● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
●
● ● ● ● ●
● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
●
● ●● ● ●
● ● ●
● ● ● ● ● ● ● ●
● ●● ● ●
● ● ●
● ● ● ●
● ● ● ● ● ●
●
0.0
● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ●● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ●
−0.5
● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●● ● ●
● ●● ● ●
● ● ● ● ●
● ●
● ● ● ● ● ●●
●● ●● ● ● ● ● ● ● ●
● ● ● ● ●
● ●
● ● ● ● ●
● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●
● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ●
● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ●
● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ●● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ●
● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ●
● ●
● ● ● ● ● ● ●
● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ●
● ●
● ● ●● ● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ●● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ●● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ●
● ●
●● ● ● ●
● ● ● ● ● ●
● ● ●
● ● ● ● ●
● ● ●
● ● ● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ●●
● ● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ●●
● ● ●
● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ●
● ● ●
● ● ●
● ● ● ●
● ● ● ●
● ● ● ● ●
● ● ● ● ●
● ● ●
● ● ●
● ● ● ●
● ● ●
● ● ●
● ● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ●
● ●
● ● ● ●
● ● ● ● ● ●
● ● ●
● ● ● ●
● ● ● ●
● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
●● ● ●
● ● ● ●
● ● ● ● ●
● ● ● ●● ●
● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ●
● ● ● ●
● ● ● ●
● ●
●
● ● ● ●
● ●
● ● ● ● ●● ●
● ● ● ● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ● ● ●
● ● ● ●
● ● ●
● ● ●
● ●
● ● ● ● ●
● ● ●
● ● ● ●
● ● ● ●● ● ● ●
● ●
● ● ●
● ● ● ● ● ● ● ● ●
● ● ●
● ● ●
● ● ●
● ● ● ● ●
● ● ● ● ●
● ● ● ●
● ●
● ● ● ● ● ● ● ● ●
● ●
● ● ● ● ●
● ● ● ● ● ● ● ● ●
● ●
● ● ● ●
●
●
● ● ● ●
●
●
● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ●
●
●
● ● ●
● ● ●
● ● ● ● ● ●
● ●
● ● ● ● ● ● ●
● ● ●
● ● ● ●
● ●
● ●
● ● ● ● ●
● ●
● ● ● ● ●
●●
● ●
● ●
● ●
●
●
● ●●
●
● ●
● ●
● ● ●
● ● ●
● ● ●
● ● ● ● ●
● ● ●
● ●
● ● ●
●
● ●
●
●
● ●
● ●
● ● ●
● ● ● ●
●
● ●
● ●
● ● ●
● ●
● ●
● ●
●
●
● ● ● ● ●
● ●
● ●
●
● ●●
● ● ● ●
−0.5
●
●
● ●
● ●
●
● ●
● ●
●
●
●
● ● ● ●
● ●
●
● ● ●
●
● ●
● ●
● ●
●
● ●
●
●
● ●
●
● ● ●
●
● ● ● ●
● ●
● ●
●
●
●
−1.0
●
●
● ● ● ●
●
●
●
●
● ● ●
●
●
● ● ●
●
●
●
●
● ●
●
● ●
● ●
● ●
● ●
● ●
● ●
● ●
● ●
0.5
0.5
● ●
● ●
● ● ● ● ● ●
● ●
● ●
● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ●
● ●
● ● ● ●
● ● ● ● ● ●
● ●
● ●
● ●
● ●
● ●
● ● ● ●
● ● ● ●
● ● ● ●
● ●
● ●
● ●
● ●
● ● ● ●
● ● ● ● ● ●
● ●
● ● ● ● ● ●
● ● ● ●
● ●
● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ●
● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ●
● ●
● ●
● ● ● ● ● ●
● ●
● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ●
● ●
● ●
● ● ● ● ● ●
● ● ● ●
● ● ● ● ● ●
● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ●