Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized...

23
Lecture 4: Generalized Linear Mixed Models Lecture 4: Generalized Linear Mixed Models Dankmar B¨ ohning Southampton Statistical Sciences Research Institute University of Southampton, UK S 3 RI, 21 - 22 November 2013 1 / 23

Transcript of Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized...

Page 1: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

Lecture 4: Generalized Linear Mixed Models

Dankmar Bohning

Southampton Statistical Sciences Research InstituteUniversity of Southampton, UK

S3RI, 21 - 22 November 2013

1 / 23

Page 2: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

An example with two nested random effects

an example with a random effect and several fixed effects

2 / 23

Page 3: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

An example: health awareness study

I three states in the US participated in a health awareness study

I each state independently devised a health awareness program

I three cities within each state were selected for participationand five households within each city were randomly selectedto evaluate the effectiveness of the program

I a composite index (a count number) was formed (the largethe index, the greater the awareness)

the data have the following hierarchical structure:

3 / 23

Page 4: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

data:

household

state city 1 2 3 4 5

1 1 42 56 35 40 281 2 26 38 42 35 531 3 34 51 60 29 442 1 47 58 39 62 652 2 56 43 65 70 592 3 68 51 49 71 573 1 19 36 24 12 333 2 18 40 27 31 233 3 16 28 45 30 21

4 / 23

Page 5: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

Poisson model with random effect for statefor the health awareness index Yijk for household k, in city j , andstate i :

log E [Yijk ]|αi= log µijk = µ + αi

with

I a state random effect αi ∼ N(0, σ2S)

I and a Poisson error Yijk ∼ Po(µijk)

5 / 23

Page 6: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

Poisson model with random effect for state

I let P(Yijk = y) = Po(y |µijk) = Po(y |µ + αi )

I likelihoodL =

∏i ,j ,k

Po(yijk |µ + αi )

(in the fixed effect case)

I but αi ∼ N(0, σ2S), e.g. normal random, so

L =∏i

∫αi

∏j ,k

Po(yijk |µ + αi )φ(αi )dαi

I where φ(αi ) is a normal density with mean 0 and variance σ2S

6 / 23

Page 7: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

7 / 23

Page 8: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with one random effect

Note: log-likelihood calculations are based on the Laplacian approximation.

LR test vs. Poisson regression: chibar2(01) = 154.39 Prob>=chibar2 = 0.0000

sd(_cons) .307096 .1278477 .1358028 .6944475

state: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons 39.81456 7.124649 20.59 0.000 28.03645 56.54067

index IRR Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -183.93181 Prob > chi2 = .

Integration points = 1 Wald chi2(0) = .

max = 15

avg = 15.0

Obs per group: min = 15

Group variable: state Number of groups = 3

Mixed-effects Poisson regression Number of obs = 45

8 / 23

Page 9: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with two nested random effects

Poisson model with random effect for state and randomeffect for city nested within state

I let P(Yijk = y) = Po(y |µijk) = Po(y |µ + αi + βj(i))

I where βj(i) ∼ N(0, σ2T ), e.g. normal random

I likelihood

L =∏i

∫αi

∫βj

∏j

∏k

Po(yijk |µ + αi + βj(i))φ(βj)dβj

φ(αi )dαi

I where φ(αi ) is a normal density with mean 0 and variance σ2S

I where φ(βj) is a normal density with mean 0 and variance σ2T

9 / 23

Page 10: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with two nested random effects

10 / 23

Page 11: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

An example with two nested random effects

Note: log-likelihood calculations are based on the Laplacian approximation.

Note: LR test is conservative and provided only for reference.

LR test vs. Poisson regression: chi2(2) = 154.39 Prob > chi2 = 0.0000

sd(_cons) 7.65e-12 .0492277 0 .

city: Identity

sd(_cons) .3070964 .127848 .1358029 .694449

state: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons 39.81457 7.124658 20.59 0.000 28.03644 56.54069

index IRR Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -183.93181 Prob > chi2 = .

Wald chi2(0) = .

city 9 5 5.0 5 1

state 3 15 15.0 15 1

Group Variable Groups Minimum Average Maximum Points

No. of Observations per Group Integration

Mixed-effects Poisson regression Number of obs = 45

11 / 23

Page 12: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

Meta-Analysis on BCG vaccine against tuberculosis

Colditz et al. 1974, JAMA provide a meta-analysis to examine theefficacy of BCG vaccine against tuberculosis

12 / 23

Page 13: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

Data on the meta-analysis of BCG and TB

the data contain the following details

I 13 studiesI each study contains:

I TB cases for BCG interventionI number at risk for BCG interventionI TB cases for controlI number at risk for control

I also two covariates are given: year of study and latitudeexpressed in degrees from equator

13 / 23

Page 14: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

intervention controlstudy year latitude TB cases total TB cases total

1 1933 55 6 306 29 3032 1935 52 4 123 11 1393 1935 52 180 1541 372 14514 1937 42 17 1716 65 16655 1941 42 3 231 11 2206 1947 33 5 2498 3 23417 1949 18 186 50634 141 273388 1950 53 62 13598 248 128679 1950 13 33 5069 47 580810 1950 33 27 16913 29 1785411 1965 18 8 2545 10 62912 1965 27 29 7499 45 727713 1968 13 505 88391 499 88391

14 / 23

Page 15: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

Data analysis on the meta-analysis of BCG and TB

these kind of data can be analyzed by taking

I TB case as disease occurrence response

I intervention as exposure (fixed effect)

I study as random effect

I latitude and year as further fixed effects

15 / 23

Page 16: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

Mixed Logistic Regression Model

logpxij

1− pxij

= µ + αi + βINTER × INTERij + βLAT × LATij

where αi ∼ N(0, σ2S)

I each trial arm within each study contributes a binomiallikelihood

I (nij

yij

)p

yijxij (1− pxij )

nij−yij

I where

pxij =exp(µ + αi + βINTER × INTERij + βLAT × LATij)

1 + exp(µ + αi + βINTER × INTERij + βLAT × LATij)

16 / 23

Page 17: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

Mixed Logistic Likelihood

I

L =∏i

∫αi

∏j

(nij

yij

)p

yijxij (1− pxij )

nij−yij φ(αi )dαi

I where φ(αi ) is a normal density with mean 0 and variance σ2S

17 / 23

Page 18: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

18 / 23

Page 19: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

.

Note: log-likelihood calculations are based on the Laplacian approximation.

LR test vs. logistic regression: chibar2(01) = 3259.71 Prob>=chibar2 = 0.0000

sd(_cons) 1.410135 .2813828 .953694 2.085029

study: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons .0149296 .005892 -10.65 0.000 .0068885 .0323576

intervention .6203579 .0255761 -11.58 0.000 .5722016 .672567

cases Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -196.3842 Prob > chi2 = 0.0000

Integration points = 1 Wald chi2(1) = 134.12

19 / 23

Page 20: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

LR test vs. logistic regression: chibar2(01) = 2180.88 Prob>=chibar2 = 0.0000

sd(_cons) 1.027901 .2080747 .6912662 1.528471

study: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons .001693 .0012119 -8.91 0.000 .0004162 .0068863

latitude 1.064961 .0201333 3.33 0.001 1.026223 1.105162

intervention .6206475 .0255857 -11.57 0.000 .5724728 .6728762

cases Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -192.38326 Prob > chi2 = 0.0000

Integration points = 1 Wald chi2(2) = 145.29

20 / 23

Page 21: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

LR test vs. logistic regression: chibar2(01) = 2019.42 Prob>=chibar2 = 0.0000

sd(_cons) .9696404 .197926 .6499213 1.44664

study: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons .0363575 .0948862 -1.27 0.204 .0002183 6.054397

year .9560516 .035339 -1.22 0.224 .8892379 1.027886

latitude 1.037569 .0289224 1.32 0.186 .9824025 1.095833

intervention .6207321 .0255885 -11.57 0.000 .5725521 .6729664

cases Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -191.68717 Prob > chi2 = 0.0000

Integration points = 1 Wald chi2(3) = 148.12

21 / 23

Page 22: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

LR test vs. logistic regression: chibar2(01) = 2346.37 Prob>=chibar2 = 0.0000

sd(_cons) 1.035618 .2104227 .6954207 1.542238

study: Identity

Random-effects Parameters Estimate Std. Err. [95% Conf. Interval]

_cons .7934227 .9916217 -0.19 0.853 .0684969 9.190487

year .9208262 .0232455 -3.27 0.001 .8763747 .9675324

intervention .6206583 .025586 -11.57 0.000 .5724831 .6728877

cases Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]

Log likelihood = -192.50774 Prob > chi2 = 0.0000

Integration points = 1 Wald chi2(2) = 144.88

22 / 23

Page 23: Lecture 4: Generalized Linear Mixed ModelsS3RI, 21 - 22 November 2013 1/23 Lecture 4: Generalized Linear Mixed Models An example with one random effect An example with two nested

Lecture 4: Generalized Linear Mixed Models

an example with a random effect and several fixed effects

model evaluation

model log L AIC BIC

intervention -196.3842 398.7684 402.5427+ latitude -192.3833 392.7665 397.7989

+ year -191.6872 393.3743 399.6648- latitude -192.5077 393.0155 398.0479

23 / 23