Minnesota Health Plan Dataset

Example of Poisson GLMM

Number of clinic visits and calls to clinic for 4 nonoverlapping six month periods for each of 121 senior citizens enrolled in a medical plan. From:

Waller LA, Zelterman D (1979). Log-Linear Modeling with the Negative Multinomial Distribution Biometrics 53(3): 971-982

These data have been used as an example by multiple authors.

Results from Zipunnikov and Booth (2006):

Term MCEM GLIMMIX WinBUGS
Intercept 0.868 (0.096) 0.961 (0.104) 0.844 (0.109)
Event -0.165 (0.127) -0.164 (0.106) -0.160 (0.110)
Period 1 -0.091 (0.095) -0.089 (0.109) -0.085 (0.111)
Period 2 0.414 (0.098) 0.394 (0.104) 0.422 (0.110)
Period 3 0.491 (0.109) 0.468 (0.103) 0.498 (0.110)
E x P 11 0.246 (0.097) 0.240 (0.103) 0.243 (0.103)
E x P 12 0.104 (0.080) 0.101 (0.095) 0.102 (0.097)
E x P 13 -0.085 (0.099) -0.084 (0.096) -0.088 (0.097)
sd(Subject) 0.493 (0.082) 0.491 (0.081) 0.511 (0.078)
sd(E:Subject) 0.608 (0.056) 0.578 (0.048) 0.605 (0.053)
sd(P:Subject) 0.625 (0.040) 0.593 (0.034) 0.627 (0.038)

The model fitted:

mod <- glmer(Count ~ Event*Period + (1|Subject) + (1|Subject:Event) + (1|Subject:Period), data=mhp, family=poisson())

Head of data:

record Count Subject Event Period
1 4 1 1 1
2 0 1 2 1
3 2 1 1 2
4 3 1 2 2
5 3 1 1 3
968 0 121 2 4
mhp <-
structure(list(Count = c(4, 0, 2, 3, 3, 0, 1, 0, 1, 9, 5, 11, 
3, 2, 5, 4, 2, 2, 10, 7, 9, 5, 1, 2, 8, 14, 6, 10, 4, 7, 3, 4, 
4, 3, 4, 3, 6, 6, 8, 8, 2, 1, 5, 4, 4, 8, 1, 0, 4, 4, 1, 0, 2, 
0, 2, 0, 1, 0, 0, 0, 4, 0, 1, 0, 1, 2, 23, 3, 11, 10, 15, 12, 
0, 0, 6, 3, 4, 4, 8, 5, 3, 4, 5, 11, 5, 12, 4, 2, 5,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 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 
14L, 14L, 14L, 14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 
15L, 15L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 
17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 18L, 
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 20L, 
20L, 20L, 20L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 
22L, 22L, 22L, 22L, 22L, 22L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 
23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 25L, 25L, 25L, 25L, 
25L, 25L, 25L, 25L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 26L, 27L, 
27L, 27L, 27L, 27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 28L, 
28L, 28L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 
30L, 30L, 30L, 30L, 30L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 
32L, 32L, 32L, 32L, 32L, 32L, 32L, 32L, 33L, 33L, 33L, 33L, 33L, 
33L, 33L, 33L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 34L, 35L, 35L, 
35L, 35L, 35L, 35L, 35L, 35L, 36L, 36L, 36L, 36L, 36L, 36L, 36L, 
36L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 37L, 38L, 38L, 38L, 38L, 
38L, 38L, 38L, 38L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 39L, 40L, 
40L, 40L, 40L, 40L, 40L, 40L, 40L, 41L, 41L, 41L, 41L, 41L, 41L, 
41L, 41L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 43L, 43L, 43L, 
43L, 43L, 43L, 43L, 43L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 
45L, 45L, 45L, 45L, 45L, 45L, 45L, 45L, 46L, 46L, 46L, 46L, 46L, 
46L, 46L, 46L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 47L, 48L, 48L, 
48L, 48L, 48L, 48L, 48L, 48L, 49L, 49L, 49L, 49L, 49L, 49L, 49L, 
49L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 51L, 51L, 51L, 51L, 
51L, 51L, 51L, 51L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 53L, 
53L, 53L, 53L, 53L, 53L, 53L, 53L, 54L, 54L, 54L, 54L, 54L, 54L, 
54L, 54L, 55L, 55L, 55L, 55L, 55L, 55L, 55L, 55L, 56L, 56L, 56L, 
56L, 56L, 56L, 56L, 56L, 57L, 57L, 57L, 57L, 57L, 57L, 57L, 57L, 
58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 59L, 59L, 59L, 59L, 59L, 
59L, 59L, 59L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 61L, 61L, 
61L, 61L, 61L, 61L, 61L, 61L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 
62L, 63L, 63L, 63L, 63L, 63L, 63L, 63L, 63L, 64L, 64L, 64L, 64L, 
64L, 64L, 64L, 64L, 65L, 65L, 65L, 65L, 65L, 65L, 65L, 65L, 66L, 
66L, 66L, 66L, 66L, 66L, 66L, 66L, 67L, 67L, 67L, 67L, 67L, 67L, 
67L, 67L, 68L, 68L, 68L, 68L, 68L, 68L, 68L, 68L, 69L, 69L, 69L, 
69L, 69L, 69L, 69L, 69L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 70L, 
71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 72L, 72L, 72L, 72L, 72L, 
72L, 72L, 72L, 73L, 73L, 73L, 73L, 73L, 73L, 73L, 73L, 74L, 74L, 
74L, 74L, 74L, 74L, 74L, 74L, 75L, 75L, 75L, 75L, 75L, 75L, 75L, 
75L, 76L, 76L, 76L, 76L, 76L, 76L, 76L, 76L, 77L, 77L, 77L, 77L, 
77L, 77L, 77L, 77L, 78L, 78L, 78L, 78L, 78L, 78L, 78L, 78L, 79L, 
79L, 79L, 79L, 79L, 79L, 79L, 79L, 80L, 80L, 80L, 80L, 80L, 80L, 
80L, 80L, 81L, 81L, 81L, 81L, 81L, 81L, 81L, 81L, 82L, 82L, 82L, 
82L, 82L, 82L, 82L, 82L, 83L, 83L, 83L, 83L, 83L, 83L, 83L, 83L, 
84L, 84L, 84L, 84L, 84L, 84L, 84L, 84L, 85L, 85L, 85L, 85L, 85L, 
85L, 85L, 85L, 86L, 86L, 86L, 86L, 86L, 86L, 86L, 86L, 87L, 87L, 
87L, 87L, 87L, 87L, 87L, 87L, 88L, 88L, 88L, 88L, 88L, 88L, 88L, 
88L, 89L, 89L, 89L, 89L, 89L, 89L, 89L, 89L, 90L, 90L, 90L, 90L, 
90L, 90L, 90L, 90L, 91L, 91L, 91L, 91L, 91L, 91L, 91L, 91L, 92L, 
92L, 92L, 92L, 92L, 92L, 92L, 92L, 93L, 93L, 93L, 93L, 93L, 93L, 
93L, 93L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 95L, 95L, 95L, 
95L, 95L, 95L, 95L, 95L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 96L, 
97L, 97L, 97L, 97L, 97L, 97L, 97L, 97L, 98L, 98L, 98L, 98L, 98L, 
98L, 98L, 98L, 99L, 99L, 99L, 99L, 99L, 99L, 99L, 99L, 100L, 
100L, 100L, 100L, 100L, 100L, 100L, 100L, 101L, 101L, 101L, 101L, 
101L, 101L, 101L, 101L, 102L, 102L, 102L, 102L, 102L, 102L, 102L, 
102L, 103L, 103L, 103L, 103L, 103L, 103L, 103L, 103L, 104L, 104L, 
104L, 104L, 104L, 104L, 104L, 104L, 105L, 105L, 105L, 105L, 105L, 
105L, 105L, 105L, 106L, 106L, 106L, 106L, 106L, 106L, 106L, 106L, 
107L, 107L, 107L, 107L, 107L, 107L, 107L, 107L, 108L, 108L, 108L, 
108L, 108L, 108L, 108L, 108L, 109L, 109L, 109L, 109L, 109L, 109L, 
109L, 109L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 110L, 111L, 
111L, 111L, 111L, 111L, 111L, 111L, 111L, 112L, 112L, 112L, 112L, 
112L, 112L, 112L, 112L, 113L, 113L, 113L, 113L, 113L, 113L, 113L, 
113L, 114L, 114L, 114L, 114L, 114L, 114L, 114L, 114L, 115L, 115L, 
115L, 115L, 115L, 115L, 115L, 115L, 116L, 116L, 116L, 116L, 116L, 
116L, 116L, 116L, 117L, 117L, 117L, 117L, 117L, 117L, 117L, 117L, 
118L, 118L, 118L, 118L, 118L, 118L, 118L, 118L, 119L, 119L, 119L, 
119L, 119L, 119L, 119L, 119L, 120L, 120L, 120L, 120L, 120L, 120L, 
120L, 120L, 121L, 121L, 121L, 121L, 121L, 121L, 121L, 121L), .Label = c("1", 
"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", 
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", 
"25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", 
"36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", 
"47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", 
"58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", 
"69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", 
"80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", 
"91", "92", "93", "94", "95", "96", "97", "98", "99", "100", 
"101", "102", "103", "104", "105", "106", "107", "108", "109", 
"110", "111", "112", "113", "114", "115", "116", "117", "118", 
"119", "120", "121"), class = "factor"), Event = structure(c(2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2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L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 
    3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 
    3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 
    2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 
    2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 
    1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 
    1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 
    4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 
    4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 
    3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 
    3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L), .Label = c("4", 
    "1", "2", "3"), class = "factor")), .Names = c("Count", "Subject", 
"Event", "Period"), row.names = c(NA, -968L), class = "data.frame")

library(lme4)
mod <- glmer(Count ~ Event*Period + (1|Subject) + (1|Subject:Event) + (1|Subject:Period), data=mhp,
family=poisson())
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License