There are four variables in my dataset. It is in the long format and looks something like this (simplified).

ID = participant ID,

Object = various objects such as a cup, a plate, a notebook,

Like= likability rating for each object, and

Use= rating for how likely the participant is to use the object.

My hypothesis is that Like will predict Use.

My question is: Is this the right way to model a multilevel model in R for the above mentioned data set:

intercept<-gls(Use~1, data=mydata, method="ML")
randomIntercept<-lme(Use~1, data=mydata, random=~1|ID, method="ML")
randomInterceptLike<-update(randomIntercept, .~. + Like)
randomInterceptLikerandomSlope<-update(randomInterceptLike, random=~ID|Object)
  • $\begingroup$ This appears to be a two-level model, not three (objects nested within participants). Because Object is a categorical or factor variable, I assume that what you are interested in knowing is whether the mean Use varies across objects after accounting for individual differences in Use (i.e., each participant's mean use). This would imply a random intercept model but fixed effects for the Object dummy codes. $\endgroup$
    – dbwilson
    May 23, 2018 at 11:09

1 Answer 1


I don't have the reputation to comment so I'll post this as an answer. I am interested in whether Like predicts Use but I want to take into consideration that the relationship between Like and Use may vary for each object and for each participant. Is something like that feasible at all?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.