I've been searching for a question that answers this for about a week on Cross Validated. Apologies if it's a repeat; I appreciate being pointed to an answer in a pre-existing question.

My experiment is a repeated measures design (also a fully-crossed design, I think) where each subject was tested at two different time points (T1 and T2). Data is in "longform" with two rows per subject, one for each time point. We measured different contextual factors (predictors) and a behavioral measure (outcome variable). All measures were administered at both time points. We are interested in whether the contextual factors are related to the behavior. The reason they were measured at two time points is because we're also interested in the stability/reliability of the behavior over time. We expect the contextual factors (things like hunger, tiredness) to vary between time points for any given individual.

While setting up the MLM in R, I structured it as follows:

FullModel <-lme(OutcomeVariable ~ 1 + Time + Hunger + Tiredness + Stress + 
    Thirst, data = longFormData, random = ~Time|Person, method = "ML", na.action 
    = na.exclude, control = list(opt="optim"))

It's my understanding that this will make Hunger, Tiredness, Stress, and Thirst fixed predictors and will allow for random slopes for each Person between Time Points.

(Please assume I ran the ICC with a random intercept model and I can see that there's a sizable proportion of within-subject variance to be accounted for in OutcomeVariable).

I've been trying to figure out whether my FullModel accounts for the fact that the two observations in Hunger, Tiredness, etc are coming from the same individual. If so, there's nothing to change. If not, I may need to add extra random effects for the predictors that exhibit a large proportion of within-subject variance (as measured by their ICC). I want to "tell" the model that this is a repeated measures design for each fixed predictor. Conceptually, I think of this as something like Hunger + Hunger|Person + Tiredness + Tiredness|Person + Stress + Stress|Person + Time + Time|Person etc. If it's needed, I'd appreciate specific suggestions about how to do this in R.

As I almost understand it, OutcomeVariable is allowed to vary between T1 and T2 within Person (random slope), but each fixed predictor is only adding a information about the intercept (pushing the line up and down but not adjusting the slope at all). My naive understanding is that if there's a lot of variation in my predictors between T1 and T2, it would be helpful to have them also influencing the slope. It would be helpful to have an explanation in terms of what is happening to the regression lines with each type of predictors if that is incomplete or inaccurate.


closed as off-topic by Michael Chernick, Peter Flom Apr 7 '18 at 12:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Michael Chernick, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.


Let me briefly answer, and I'm happy to elaborate as need be.

It sounds as though the model you want to run is

random = ~1 + Time | Person

This will account for a different "average" for each person, and it will allow for a random slope for time. Though, in this case, if you have only two times points (with all individuals having the same values), this such a model doesn't have enough "randomness" to draw from to separate estimated value and variation. That is, you are essentially just modeling the exact difference for each person from time 1 to time 2.

However, for the other values, which have multiple measurements at different times, these values may not be consistent from person to person, so there may be a meaningful amount of variation in the model.

Lastly, you can add anything to the random equation that was measured at each time point. And you cannot add anything to the random equation that was measured only once for the individual (that can only be a fixed effect).

Hope this helps.

  • $\begingroup$ Thank you for your helpful answer. I'm pretty sure I understand, but to clarify, it'd look something like: FullModel <-lme(OutcomeVariable ~ 1 + Hunger + Tiredness + Stress, data = longFormData, random = ~1 + Hunger + Tiredness + Stress + Time|Person correct? $\endgroup$ – quickestsilver Apr 6 '18 at 18:15
  • $\begingroup$ Also, as a follow-up, what kind of power does adding multiple random effects require? I've heard that there should be 5-6 observations per level for a random effect which I think I probably have, but I get the error, "fewer observations than random effects in all level 1 groups" when I add multiple random effects. I have 90 subjects and 173 observations (not all subjects are in T2). $\endgroup$ – quickestsilver Apr 6 '18 at 18:28
  • $\begingroup$ It seems a bit strange to me that you would use the same data to answer two conceptually different research questions: 1. Are the scores/outcomes at time T1 consistent with the scores/outcomes at time T2? and 2. Is there a change over time in the scores/outcomes? If you are concerned with consistency from one time occasion to another, that suggests that you are trying to validate (?) the instrument/method which produces the scores/outcomes. So it may be premature to use the instrument/method to answer your second research question (?). $\endgroup$ – Isabella Ghement Apr 6 '18 at 19:45
  • $\begingroup$ You are correct...ideally, you would want more than 2 observations per level. This may be causing the error/warning. $\endgroup$ – Gregg H Apr 6 '18 at 20:01

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