I want to conduct a multilevel poisson regression analysis, but I find myself stuck with the results of the glmer fuction.
In total I have 3115 observation of 20 variables. One of these observations is my Level2 variable, the pickers. In total I have 35 pickers, which R also confirms:
When I create my regression model as follows:
r1 <- glmer(MOP ~ Age+Contract+Promotion+Prevention+Conscientiousness+Neuroticism+
(1|SubjectID), family = poisson, data = Data)
summary(r1)
Where subjectID is the numeric label for the pickers.
R returns me this:
Random effects:
Groups Name Variance Std.Dev.
SubjectID (Intercept) 0.08706 0.2951
Number of obs: 2629, groups: SubjectID, 29
Does anyone know why R only recognizes 29 Subject IDs and 2629 observations instead of taking the whole data set into his calculations?
Do any of the data rows have missing data for any of the variables used in the regression? glmer will oly include rows with complete data for the columns used in the regression model. For example:
library(lme4)
length(unique(sleepstudy$Subject))
#> [1] 18
sum(complete.cases(sleepstudy))
#> [1] 180
m = glmer(Reaction ~ Days + (1|Subject), data=sleepstudy)
summary(m)
#> Number of obs: 180, groups: Subject, 18
# Create missing data
d = sleepstudy
d$Days[c(6,25,51,104:105,112,141:150)] = NA
length(unique(d$Subject))
#> [1] 18
length(unique(d$Subject[complete.cases(d)]))
#> [1] 17
sum(complete.cases(d))
#> [1] 164
m=glmer(Reaction ~ Days + (1|Subject), data=d)
summary(m)
#> Number of obs: 164, groups: Subject, 17