Hi,

I have a question about adjusting for time-varying covariates using multilevel linear mixed models.
I have physical activity (mvpadaily) measured at three points in time (baseline, 4- and 8 months), together with accelerometer wear time (meanmin) at all three time points.

The data is organized in long format, like this:
id time mvpadaily meanmin
1 1 X A
1 2 Y B
1 3 Z C

I want to adjust mvpadaily at time 1 (X) for meanmin at time 1 (A), mvpadaily at time 2 (Y) for meanmin at time 2 (B) and mvpadaily time 3 (Z) for meanmin at time 3 (C).
When the data is in long format, I was wondering if Stata adjusts for the right measurement at the right time-point when I add meanmin as a covariate like this:

mixed mvpadaily i.groupxtime meanmin || cluster: || id:, reml

Does this seem like the correct way to do this? If not, how should this model be built to ensure that I adjust at the correct points in time?
I have read about splitting the covariate into between- and within-person effects, but I am not sure if that is a more correct approach to this issue?

Best,
Hilde