4.2 Slides - Generalized Linear Mixed Models Part 1
4.2 Slides - Generalized Linear Mixed Models Part 1
4.2 Slides - Generalized Linear Mixed Models Part 1
Mixed Models
(GLMMs)
Eventueel ondertitel
Cas Kruitwagen
Combining GLM’s and Mixed Models
In this presentation we will look at:
2
Linear Regression
• Data
– Continuous outcome variable
Y:
We assume the outcome for
each individual i comes from
N(μi ; σ2).
– Approach: we model μi given
a (set of) predictor variable(s)
X.
• Model
– Yi = β0 + β1 X1i + εi
– εi ~ N(0 ; σ2)
– εi independent for i = 1, …, n
3
Generalized Linear Models
• Data
o Outcome variable Y
o Predictor variable(s) X
• Model
o Left-hand side: Y (continuous, dichotomous, count, ordinal,
categorical, etc., from the exponential family)
o Right-hand side: linear equation β0 + β1 X1i + … + βp Xpi
o Left- and right-hand side are linked together using an
appropriate “link function”
4
Generalized Linear Models
• Example: logistic regression
o Dichotomous outcome variable Y (1/0), e.g.
• pregnant (1 = yes, 0 = no),
• heart disease (1 = yes, 0 = no).
o Assumed distribution of the outcome: binomial.
• Each individual i that is drawn can be seen as the outcome of a
“Bernoulli trial”, with success probability P(Yi=1).
o Principle: we model the success probability P(Yi=1), given a set of
predictor variables.
5
Generalized Linear Models
• Example: logistic regression
o Dichotomous outcome variable Y (1/0).
o Link function: logit
P( Y 1)
logit P( Y 1) ln
1 P( Y 1)
o Model:
P( Yi 1)
ln β0 β1 X 1i ... β p X pi
1 P( Yi 1)
• For example:
o Y = pregnant (1 = yes, 0 = no), X = age, weight, LHB/CGB genes,
etc.
o Y = heart disease (1 = yes, 0 = no), X = age, weight, exercise,
blood pressure, cholesterol
• Note that 𝑒 𝛽𝑝 is the odds ratio corresponding to the effect of Xp on Y.
6
Generalized Linear Models
• Example: Poisson regression
o Outcome variable Y: count within a given time or space, e.g.
• Y = number of urinary tract infections per year,
• Y = number of telephone calls in NL on a given date,
• Y = number of insects on a plot of land.
o Assumed distribution of the outcome: Poisson.
• Parameter: rate λ (=mean, =variance).
• The Y value for each individual i that is drawn can be seen as a draw
from a Poisson distribution with rate λi
o Principle: we model the rate λi, which is equal to the expected
count E(Yi), given a set of predictor variables.
7
Generalized Linear Models
• Example: Poisson regression
o Count outcome variable Y.
o Link function: natural logarithm.
o Model:
lnE (Yi ) 0 1 X 1i ... p X pi
• For example:
o Y = number of urinary tract infections per year, X = age, weight,
antibiotics use, cranberry use, etc.
o Y = number of telephone calls in NL on a given date, X =
working day, season, temperature, economy, etc.
8
Generalized Linear Models
• Poisson regression: offset
o Varying exposure window, e.g.
• Insects (not all plots of land which we observe have the same size ->
insects/km2).
• Infections (not all patients were followed for the same length of time
-> infections/year).
o Formula:
E (Yi )
ln 0 1 X 1i ... p X pi
exposure