w6 - Statistical Modelling
w6 - Statistical Modelling
120
Agenda
• Motivation
• Exponential family
• Comparison of models
• Extensions
121
. . . Agenda
122
The Problem
▶ a response variable Y
▶ predictions
▶ inference
▶ given Xi = xi ,
Yi = β0 + β1 xi1 + . . . + βp xip + εi , i = 1, . . . , n
where the error terms (εi ) are iid with εi ∼ N(0, σε2 )
▶ equivalently, given Xi = xi ,
where
E [Yi |Xi = xi ] = β0 + β1 xi1 + . . . + βp xip
and the Yi independent
124
. . . Linear Models
Yi ∼ N(µi , σε2 )
and independent
E [Yi ] = µi = g −1 (ηi ) = ηi
where g =Id
125
Shortcomings of the Linear Model
126
. . . Shortcomings of the Linear Model
▶ Example.
127
Generalized Linear Models
ηi = β0 + β1 xi1 + . . . + βp xip
128
Exponential Family
{fθ (y )| θ ∈ Θ}
129
Exponential Family
• Two parameters
• Further
y µ − µ2 /2 1 y2
2
= exp − + log(2πσ )
σ2 2 σ2
so that
θ = µ, ϕ = σ 2 , a(ϕ) = ϕ = σ 2
θ2 1
b(θ) = , c(y , ϕ) = − (y 2 /2 + log(2πϕ))
2 2
VAR[Y ] = V (µ)a(ϕ)
132
. . . Exponential Family
µy e−µ
= exp (y log µ − µ − log(y !))
y!
so that
θ = log µ, b(θ) = µ = eθ , ϕ = 1
a(ϕ) = 1, c(y , ϕ) = − log(y !)
133
. . . Exponential Family
• Some examples
model fY (y ; θ, ϕ) E [Y ] θ b(θ) ϕ a(ϕ)
θ2
N(µ, σ 2 ) µ µ 2
σ2 ϕ
Gamma(α, λ) µ= α
λ
− µ1 − log(−θ) α 1
ϕ
Poisson(µ) µ log µ eθ 1 1
µ
Bernoulli(p) µ=p log 1−µ
log(1 + eθ ) 1 1
134
. . . Exponential Family
γ
• Weibull: fY (y ; c, γ) = c γ y γ−1 e−c y , y > 0, with c > 0, γ > 0
135
The Link Function
▶ E [Y ] = µ = pass prob.
η = αT + β1 N + β2 S
g (µ) = η ⇔ µ = g −1 (η)
eη
µ
η = g (µ) = log , µ = g −1 (η) =
1−µ 1 + eη
137
. . . The Link Function
138
. . . The Link Function
2 how much would the probability change if the fourth assignment were
submitted
3 what is the highest pass probability for someone who does not attend
tutorials?
139
. . . The Link Function
• Exercise.
1 use
ηb = −1.501 + 0.5459 · 3 + 0.0251 · 60 = 1.6427
1.6427
e
and so µb = 1+e 1.6427 = 84%
and µ
b = 4%; max prob.:
and µ
b = 96%
140
. . . The Link Function
η = β0 + β1 X1 + . . . + βp Xp = g (µ)
µ = g −1 (η) = g −1 (β0 + β1 X1 + . . . + βp Xp )
141
. . . Link Function
• Link function choice g is not unique but must be consistent with the
range of µ = E [Y ]
θ = η = g (µ)
recalling that
µ = b ′ (θ)⇝ θ = (b ′ )−1 (µ)
the canonical link function is
143