[R-sig-ME] Estimating 2-level fixed effect slopes for a random effect
Ché Lucero
chelucero at uchicago.edu
Thu Jan 21 20:51:18 CET 2016
Hi there.
I have a behavioral dataset that has a structure like this:
dat <- data.frame(Subject = rep(c('John', 'Mary', 'Roberta'), each=2),
Behavior = rep(c('A', 'B'), 3), Count = c(0, 4, 1, 3, 2, 6))
I fit models that looks like
glm.1 <- glmer(Count ~ Behavior + (1+Behavior|Subject), data = dat,
family='poisson')
glm.2 <- update(glm.2, . ~ . - Behavior)
and then do an LRT with
anova(glm.1, glm.2)
My question is about the random effects, and particularly estimation of the
random Behavior slopes for Subjects.
My understanding is that the random intercepts for Subjects models
idiosyncratic over-or-under contributing by Subjects (e.g. John gives A: 35
B:42). I understand the random Behavior slopes for Subject to be modeling
idiosyncratic differences between the A and B Behavior counts for each
Subject (e.g. John gives A:4 B:23), so that you can detect a genuine
difference between A vs B Counts that isn't driven by particular subjects.
In my dataset, glmer seems to be able to estimate the random slopes. Is it
appropriate to include slopes in the model given that there are only two
datapoints (an A count and a B count) for each subject? Can the model
reasonably estimate by-Subject Behavior slopes appropriately with just the
two observations per Subject?
Also to clarify, is the random 'slope' in the case of a poisson
distribution essentially modeling a Count difference between A and B for
each subject?
random effects output from the model summary, in case it's helpful:
Random effects:
Groups Name Variance Std.Dev. Corr
Subject (Intercept) 0.8942 0.9456
BehaviorB 0.4539 0.6737 -0.59
Number of obs: 160, groups: Subject, 80
Thank you!
-Ché
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list