# Mixed model for trial-based analysis

I conducted an experiment that investigated preferences for two-digit numbers. Each digit was randomly drawn from a list of digits between 1 and 9, with one digit presented at a leftish position and one at a rightish position on the screen. The resulting two-digit number was either congruent to a previously learned association or not. Each participants received 50 trials (i.e., 50 2-digit presentations) and should indicate how much they like the respective digit arrangement for each trial on scale from 0 to 10.

I found a main effect of congruency. However, I am wondering whether preferences could be alternatively explained by preferences for higher compared to lower numbers. Thus, I would like to consider the tenner of the two-digit number (i.e., the digit appearing at the leftish) position in my analyses. I guess that mixed models would be the analysis of choice; however, as I am completely new to this, I am struggling to find the right model.

Currently, my model looks like this:

preference ~ congruency*tenner + (1|subject)


Yet, I am almost convinced that this is not the most adequate solution and would hence be grateful for any suggestions.

*** EDIT - On the variables:

• congruency is nominal and binary (congruent vs. incongruent)
• tenner is interval-scaled (possible values: 1, 2, 3, 4, 5, 6, 7, 8, 9)
• preference is interval-scaled (possible values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
• Can you add a bit more detail about the data - what king of variables are preference ,congruency and tenner ? – Robert Long Aug 11 '20 at 7:12
• what *kind, not king ! – Robert Long Aug 11 '20 at 7:23
• @RobertLong Thank you for your comment, I added some details about the variables and hope this helps in clarification. – Lafayote Aug 11 '20 at 8:08

preference ~ congruency*tenner + (1|subject)


With a scale from 0 to 10 it would seem reasonable to treat this as numeric and fit a linear model.

seems like a good place to start. Obviously you have repeated measures in subjects, so provided that you have a sufficient number of subjects, random intercepts are a good way to handle that.

The model will estimate a global intercept, which is the expected value of preference when congruency is at it's reference level, and tenner is zero. Since zero if outside the range that tenner takes you might want to centre it, to improve interetation.

The main effect for congruency will be the estimated association between the outcome, and the difference between the two levels of congruency when tenner is zero (again, centring should be considered), and the main effect of tenner will be the estimated association between a 1 unit change in tenner and the outcome (ie the linear slope), when congruency is at it's reference level. The interaction will be the estimated difference in the slope for tenner between the two congruency groups.

You might consider extending the model by fiting random slopes for congruency*tenner if you have reason to believe they these should vary between subjects.

• Thanks for your reply, this helps a lot! Regarding the random slopes for congruency*tenner: Would this imply preference ~ congruency*tenner + (congruency*tenner | subject)? – Lafayote Aug 11 '20 at 11:10
• Yes, this would then be a "maximal model". Sometimes (quite often actually) the data do not support such a model either because there is no variation of these fixed effects by subject or because there are too many parameters to estimate from the data, and some or all of the random slopes have to be removed. See my answer here for what to do in those circumstances. – Robert Long Aug 11 '20 at 11:14