I am attempting my first efforts at nonlinear mixed effect modeling for experimental data using the R package lme4. The model predicts Choice (binary 0/1) data using two independent variables that change on each trial, across two conditions, nested in the random effects of each participant (SubjectID). I have provided a more concrete example below. I have within-subjects design with repeated measures, in each of two conditions.
Ultimately, I'm interested in how to compare the relative predictive power of each independent variables across conditions.
For example, we have participants who must choose which product to buy between a stock product used as a comparison in every trial, and a new product with varying Size and Time of Assembly. BuyNew (both independent variables are continuous where Size positively predicts buying the new product and Time of Assembly negatively predicts buying the new product). These products are repeatedly shown to the same individual with different Brand-labeling (a manipulated condition with 2 levels). The glmer function for the full model would look like the following:
ME.model <- glmer(formula = BuyNew ~ Size*AssemblyTime + Brand + (1| SubjectID), family = “binomial”, data = .)
Let’s assume Brand is a significant predictor of Buy and there are many Brands. I would like to compare the betas for Size, AssemblyTime, and Size:AssemblyTime to see how they vary depending on the Brand. The emphasis is on how the relationships change, rather than the presence/absence of an interaction effect.
To do this, I might split the data by Brand to make separate models for each Brand and compare the betas, but if I do this, can I hold the random effects the same for all models (force them to use the ranef() from the initial model)? Is there a better way to compare the betas between Brands?
Another idea is to create independent variables for each Brand (when present) and 0 when the new product does not have that particular brand:
glmer(formula = Buy ~ Sizeb1*AssemblyTimeb1 + Sizeb2*AssemblyTimeb2 +... Sizebj*AssemblyTimebj + (1| SubjectID), data = ., family =“binomial”)
Where bj refers to the Size and AssemblyTime of a product when it has a particular Brand(j) and 0 otherwise. This seems less elegant/formal because it involves creating several variables that are highly correlated, but would be able to compare the overall beta-sizes between conditions.
Thanks in advance for the help!