Skip to content
Prev 15903 / 20628 Next

Model within subjects treatment variable and multiple measurements per treatment: is this the correct model?

Hi Nynke,

Can you paste the first few rows of your dataset so that we can take a look at the way you coded your variables? The way I would do it is to create a single factor variable "treatment" with three levels "HealthPrime", "HedPrime", and "NonfPrime". It seems like you coded them as separate variables, which is fine, but makes the model syntax somewhat cluttered.

If you code them as a single variable, the way I would do it would be:

fit <- lmer(choice_topbottom ~ treatment * (tastiness_dif_topminbottom + healthiness_dif_topminbottom) * DEBQ_restraint) + (1|pp_code),data=data)

If you want to keep your predictors coded as separate columns, replace 'treatment' by your three treatments separated by a plus. In that case, your formula is probably correct (though it's also a bit challenging to read so I didn't look at it in too much detail!). Note that the * operator for interactions automatically includes any lower-order interactions and the main effects, so there is no need to state those explicitly (but also no harm).

Note that, in any case, you may also want to consider by-participant random slopes for your predictors.

Best,
Cesko
Message-ID: <D14049CE02C4F54D95360EEC06CE45C50F799464@SPMXM08.VUW.leidenuniv.nl>
In-Reply-To: <SN1PR10MB1007EB41FB504A0A413457A4DB480@SN1PR10MB1007.namprd10.prod.outlook.com>