[R-sig-ME] Model within subjects treatment variable and multiple measurements per treatment: is this the correct model?

Voeten, C.C. c.c.voeten at hum.leidenuniv.nl
Wed Oct 18 10:05:47 CEST 2017


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

> -----Oorspronkelijk bericht-----
> Van: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-
> project.org] Namens Nynke l
> Verzonden: vrijdag 13 oktober 2017 21:50
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: [R-sig-ME] Model within subjects treatment variable and
> multiple measurements per treatment: is this the correct model?
> 
> Hello all,
> 
> I have a question regarding my analysis and how to correctly model this in r
> syntax.
> I have a dataset from an experiment in which each subject received 3
> treatments (HealthPrime, HedPrime and NonfPrime; within subjects factor).
> In each of these treatments, 40 measurements have been done of my DV
> (choice_topbottom, contineous variable) and two other predictor variables
> (tastiness_dif_topminbottom and healthiness_dif_topminbottom). In
> addition, I have a subject level variable (DEBQ_restraint) for which I would
> like to know if there is an interaction with treatment or the predictor
> variables.
> 
> What I basically want to know is if there is a difference between the
> treatments in how tastiness_dif_topminbottom and
> healthiness_dif_topminbottom relate to choice_topbottom. And I would like
> to know whether this is influenced by DEBQ_restraint.
> 
> Is the model below correct to take into account the fact that the treatment is
> a within subjects factor and that there are multiple measurements per
> treatment?
> 
> fit <- lmer(choice_topbottom ~ tastiness_dif_topminbottom +
> healthiness_dif_topminbottom + HealthPrime*tastiness_dif_topminbottom
> + HedPrime*healthiness_dif_topminbottom +
> HedPrime*tastiness_dif_topminbottom +
> HealthPrime*healthiness_dif_topminbottom + (1 | pp_code) +
> DEBQ_restraint + tastiness_dif_topminbottom*DEBQ_restraint +
> healthiness_dif_topminbottom*DEBQ_restraint +
> HealthPrime*tastiness_dif_topminbottom*DEBQ_restraint +
> HedPrime*healthiness_dif_topminbottom*DEBQ_restraint +
> HedPrime*tastiness_dif_topminbottom*DEBQ_restraint +
> HealthPrime*healthiness_dif_topminbottom*DEBQ_restraint, data = data)
> 
> I hope someone with more experience in these kind of models can let me
> know whether this is correct.
> 
> Many thanks in advance!
> 
> Best,
> Nynke
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list