I am interested in the modelling of time-varying predictors in a multilevel growth model in R.
Specifically, I am working with three-level data (measures collected across four timepoints (0,12,18,24 months) on pupils nested within schools). I am interested in exploring the extent to which a time-varying predictor (a school characteristic) can explain outcome variance at the pupil- and school-level (my outcome is measured on a continuous scale).
I am now wondering how I could introduce this time-varying predictor in my models? (I am running my analyses in R version 3.6.2.; and I use the R package 'lmer' to fit my multilevel growth models). I assume introducing each measure of the time-varying predictor (at 0-24 months) as a separate predictor in the models would not be appropriate?! Hence, I wonder whether I could reshape the data into the long format to not only have my outcome and time represented by one variable but also this time-varying predictor? I could then use this one variable of my time-varying predictor (which summarises in the long format all measures across time) to predict my outcome? Would this be appropriate? Or is there any other way to model time-varying predictors in this context?
Also by doing it this way (modelling the time-varying predictor in the long-format) would I then be able to examine the longitudinal relationship between the time-varying predictor and the outcome over time or would the estimates represent the cross-sectional relationship (i.e., for each assessment wave the relationship between the time-varying predictor and the outcome at that point in time)?
Any advice would be very much appreciated.