Skip to main content
edited tags
Link
kjetil b halvorsen
  • 82.8k
  • 32
  • 201
  • 663
Tweeted twitter.com/StackStats/status/855979484083871744
added 269 characters in body
Source Link
Nova
  • 565
  • 5
  • 17

exp(0.3507) = 1.42
How can I interpret this number? Is it the average standard deviation within IDs? As in, within any group, the count differs by a standard deviation of 1.42? This might mean that we would find that most counts within a group would be within exp(1.960.3507) = 1.98 above or below the mean for that ID? Or, that in general the spread of count data within one tree would fall within exp(21.96*0.357) = 4.05 species?

Thierry's explanation on the hyperlinked page was that the highest 97th percentile tree would have 4 X the number of species as the lowest, so I wonder if I'm getting this wrong - as in, the actual interpretation would be that over ALL IDs, the counts differ by 4X from the lowest counts to the highest.

Am I onWhat is the right track, or should I be interpreting these differentlycorrect interpretation?

Here the example: library(lme4) library(ggplot2)

library(lme4)
library(ggplot2)

df <- data.frame(ID = c("A", "A", "A", "A",
                        "B", "B", "B", "B",
                        "C", "C", "C", "C",
                        "D", "D", "D", "D",
                        "E", "E", "E", "E"),
                 Count = c(1, 4, 5, 9, 
                           2, 3, 4, 10, 
                           8, 12, 21, 14, 
                           15, 17, 12, 23, 
                           17, 27, 12, 19),
                 Group = c(1, 1, 1, 1,  
                           1, 1, 1, 1, 
                           1, 1, 1, 1,  
                           2, 2, 2, 2, 
                           2, 2, 2, 2))

fit <- glmer(Count ~ Group + (1|ID), data = df, family = "poisson")


ggplot(df, aes(x = Group, y = Count, group = Group)) + 
  geom_boxplot()

ggplot(df, aes(x = ID, y = Count)) +
  geom_point()

ggplot(df, aes(x = ID, y = Count)) +
  geom_boxplot()

summary(fit)

exp(0.3507) = 1.42
How can I interpret this number? Is it the average standard deviation within IDs? As in, within any group, the count differs by a standard deviation of 1.42? This might mean that we would find that most counts within a group would be within exp(1.960.3507) = 1.98 above or below the mean for that ID? Or, that in general the spread of count data within one tree would fall within exp(21.96*0.357) = 4.05 species?

Am I on the right track, or should I be interpreting these differently?

Here the example: library(lme4) library(ggplot2)

df <- data.frame(ID = c("A", "A", "A", "A",
                        "B", "B", "B", "B",
                        "C", "C", "C", "C",
                        "D", "D", "D", "D",
                        "E", "E", "E", "E"),
                 Count = c(1, 4, 5, 9, 
                           2, 3, 4, 10, 
                           8, 12, 21, 14, 
                           15, 17, 12, 23, 
                           17, 27, 12, 19),
                 Group = c(1, 1, 1, 1,  
                           1, 1, 1, 1, 
                           1, 1, 1, 1,  
                           2, 2, 2, 2, 
                           2, 2, 2, 2))

fit <- glmer(Count ~ Group + (1|ID), data = df, family = "poisson")


ggplot(df, aes(x = Group, y = Count, group = Group)) + 
  geom_boxplot()

ggplot(df, aes(x = ID, y = Count)) +
  geom_point()

ggplot(df, aes(x = ID, y = Count)) +
  geom_boxplot()

summary(fit)

exp(0.3507) = 1.42
How can I interpret this number? Is it the average standard deviation within IDs? As in, within any group, the count differs by a standard deviation of 1.42? This might mean that we would find that most counts within a group would be within exp(1.960.3507) = 1.98 above or below the mean for that ID? Or, that in general the spread of count data within one tree would fall within exp(21.96*0.357) = 4 species?

Thierry's explanation on the hyperlinked page was that the highest 97th percentile tree would have 4 X the number of species as the lowest, so I wonder if I'm getting this wrong - as in, the actual interpretation would be that over ALL IDs, the counts differ by 4X from the lowest counts to the highest.

What is the correct interpretation?

Here the example:

library(lme4)
library(ggplot2)

df <- data.frame(ID = c("A", "A", "A", "A",
                        "B", "B", "B", "B",
                        "C", "C", "C", "C",
                        "D", "D", "D", "D",
                        "E", "E", "E", "E"),
                 Count = c(1, 4, 5, 9, 
                           2, 3, 4, 10, 
                           8, 12, 21, 14, 
                           15, 17, 12, 23, 
                           17, 27, 12, 19),
                 Group = c(1, 1, 1, 1,  
                           1, 1, 1, 1, 
                           1, 1, 1, 1,  
                           2, 2, 2, 2, 
                           2, 2, 2, 2))

fit <- glmer(Count ~ Group + (1|ID), data = df, family = "poisson")


ggplot(df, aes(x = Group, y = Count, group = Group)) + 
  geom_boxplot()

ggplot(df, aes(x = ID, y = Count)) +
  geom_point()

ggplot(df, aes(x = ID, y = Count)) +
  geom_boxplot()

summary(fit)
Source Link
Nova
  • 565
  • 5
  • 17

Interpreting Random Effects for Poisson GLMM

There seem to be a few answers for normally distributed models, but after some searching I could only come across this page for Poisson mixed models. I want to be certain I am interpreting the random effects properly.

I'll paste my output and provide the reproducible code at the bottom. Let's pretend we are counting species of moths in two different habitat groups on 5 different individual trees.

summary(fit)
    # Generalized linear mixed model fit by maximum likelihood
    # (Laplace Approximation) [glmerMod]
    # Family: poisson  ( log )
    # Formula: Count ~ Group + (1 | ID)
    # Data: df
    # 
    # AIC      BIC   logLik deviance df.resid 
    # 132.2    135.2    -63.1    126.2       17 
    # 
    # Scaled residuals: 
    #   Min      1Q  Median      3Q     Max 
    # -1.8708 -1.0472 -0.2687  0.6795  2.3808 
    # 
    # Random effects:
    #   Groups Name        Variance Std.Dev.
    # ID     (Intercept) 0.123    0.3507  
    # Number of obs: 20, groups:  ID, 5
    # 
    # Fixed effects:
    #   Estimate Std. Error z value Pr(>|z|)   
    # (Intercept)   1.0236     0.5339   1.917  0.05520 . 
    # Group         0.9226     0.3502   2.634  0.00843 **
    #   ---
    #   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # 
    # Correlation of Fixed Effects:
    #   (Intr)
    # Group -0.945

Ok. So I think that exp(0.9226) = 2.51 means that in the second group, Counts are up by 2.5 x what they are in the first group. That's fine, it makes sense if we look at the plots I made (in code below).

But what about the random effects? First, I assume I should exponentiate them as well...?

exp(0.3507) = 1.42
How can I interpret this number? Is it the average standard deviation within IDs? As in, within any group, the count differs by a standard deviation of 1.42? This might mean that we would find that most counts within a group would be within exp(1.960.3507) = 1.98 above or below the mean for that ID? Or, that in general the spread of count data within one tree would fall within exp(21.96*0.357) = 4.05 species?

Am I on the right track, or should I be interpreting these differently?

Here the example: library(lme4) library(ggplot2)

df <- data.frame(ID = c("A", "A", "A", "A",
                        "B", "B", "B", "B",
                        "C", "C", "C", "C",
                        "D", "D", "D", "D",
                        "E", "E", "E", "E"),
                 Count = c(1, 4, 5, 9, 
                           2, 3, 4, 10, 
                           8, 12, 21, 14, 
                           15, 17, 12, 23, 
                           17, 27, 12, 19),
                 Group = c(1, 1, 1, 1,  
                           1, 1, 1, 1, 
                           1, 1, 1, 1,  
                           2, 2, 2, 2, 
                           2, 2, 2, 2))

fit <- glmer(Count ~ Group + (1|ID), data = df, family = "poisson")


ggplot(df, aes(x = Group, y = Count, group = Group)) + 
  geom_boxplot()

ggplot(df, aes(x = ID, y = Count)) +
  geom_point()

ggplot(df, aes(x = ID, y = Count)) +
  geom_boxplot()

summary(fit)