I have collected data for a study that had the following design:
Subjects walked through a food pantry five different days during one of two conditions: signs-down (no signs displayed, 2 days) and signs-up (signs displayed, 3 days) -- between-subjects variable.
Within-subjects: Within the signs-up condition, we had two types of signs displayed -- guided-play signs (with an active learning goal) or free-play signs (with no active learning goal).
Within-subjects: Within the guided-play condition, we had two signs -- signs that asked math questions and signs that asked questions about colors and shapes.
Within-subjects: Within the free-play condition, we had two signs -- signs that asked questions with only one-word answers and pronouncement signs (generic statements).
My DV here is a count variable of the number of certain kinds of behaviors families engage in during the observation period (qual_talk
).
This is what my data looks like:
subject_number type_signs_guided_free signs qual_talk
<dbl> <fct> <fct> <dbl>
1 51 guided play math 1
2 51 guided play colors & shapes 0
3 51 free play one word answers 1
4 52 guided play math 1
5 52 guided play colors & shapes 0
6 52 free play pronouncements 0
7 52 free play one word answers 0
8 53 guided play math 2
9 54 guided play colors & shapes 0
10 55 free play pronouncements 0
11 56 guided play math NA
12 56 free play pronouncements 0
13 56 free play one word answers 2
14 57 guided play math 1
15 57 guided play colors & shapes 2
16 57 free play pronouncements 0
17 57 free play one word answers 0
18 58 guided play colors & shapes 0
19 58 free play pronouncements 0
20 58 free play one word answers 0
# … with 326 more rows
Basically, I am interested in two within-subjects questions: (1) the effect of guided-play signs vs. free-play signs on the DV. (2) the effect of math signs vs. colors & shapes signs on the DV and one-word answers signs vs. pronouncements signs on the DV.
This is the current model I have, but I can't quite seem to capture the nesting (or multilevel) element just right. Here, I am trying to fit a mixed-effects Poisson regression model with qual_talk
as the DV, type_signs_guided_free (guided vs. free play), child's gender, child's age as the fixed effects, and random intercepts by subject.
glmer(qual_talk ~ type_signs_guided_free + child1gender + target_child_age + (1|subject_number), family = poisson(link = "log"), data = foodpantry)
Any ideas on how to do this using glmer
? If any part of my question is unclear, I would be happy to explain in more detail. The closest I got to an answer is this link, but it doesn't fully translate to my case.
Thanks in advance!