I'm new to linear mixed modeling, and have some theory-driven questions that I'm not sure how to analytically resolve.
I am analyzing experimental data with a within-subjects factor (discount
). My theory hypothesizes that the effect of this within-subjects factor is contingent upon a between-subjects characteristic of respondents (iipm
). Because my data is in long form, and respondents are making 8 choices over time, I model my data as follows:
library(lme4)
m1 <- glmer(chose ~ iipm*discount + product + (1|id) + (1|time), data=long1,
family="binomial")
All that I'm trying to do here is fit a simple model that accounts for the dependence between observations for a single subject (1|id
), and the potential effect of making several choices in a row (1|time
).
However, my theory further specifies that this relationship should not be affected by the inclusion of other demographic variables in the model (let's say ideology
and partisanship
). So, based on some reading I've done (as well as previous answers on this site), I fit the following model:
m2 <- glmer(chose ~ iipm*discount + product + (1 |id) + (1|time) + (1|partisanship) +
(1|ideology) , data=long1, family="binomial")
Because random slopes goes beyond my expertise, I'm just using random intercepts to see what happens when I account for baseline variation amongst individuals attributable to their partisanship and ideology. However, if I were to use random slopes to essentially say that the effects of partisanship and ideology vary on an individual basis, even after accounting for baseline variability, I should specify the following model:
m3 <- glmer(chose ~ iipm*discount + product + (1 + partisanship +ideology |id) +
(1|time) , data=long1, family="binomial")
To test the hypothesis that this baseline variability doesn't matter, I then run a likelihood ratio test comparing the two models:
library(lmtest)
lrtest(m2,m1) # p=.349
lrtest(m3,m1) # p=.416
If there's no improvement in fit (p>.05), I (very tentatively) interpret this as support for my hypothesis that demographics
and ideology
don't matter.
Is this a right way to approach the data, or is there a more sophisticated way to test this hypothesis using multilevel modeling? Any expertise and advice is greatly appreciated.