I'm running a multivarialte repeated measures hierarchical linear model in r's nlme package. I have three dependent variables D1, D2, and D3.
My variable structure is such that a time point is nested within a participant, which is nested within their respective group.
A snapshot of my data is below:
In order to bring this to a multivariate space, I've dummy coded my three dependent variables, as per this tutorial
However, I'm having trouble conceptualizing the model with three nests, rather than 2. I've come up with two possible solutions and could use someone's help in determining which one is implementing the correct structure (i.e., group/id/time)
Thus, my possible equations are:
model <- lme(value ~ 0 + D1:Time + D2:Time + D3:Time, random = ~0 + D1:Time + D2:Time + D3:Time | Group/ID , data = Fixed_Data)
model <- lme(value ~ 0 + D1 + D2 + D3, random = ~0 + D1 + D2 + D3| Group/ID/Time , data = Fixed_Data)
Am I on the right track for either of these solutions?
Thanks for the help?