# Repeated measures mixed model in r

I want to compare how fast children from 2 countries [Country] run on a treadmill [Speed] at two time points [Time]. Specifically, I wanto to see whether the change over time is different in those two countries. Moreover, I want to control for the fixed effects of age at baseline [Ageb], weight at baseline [Weightb], and height at baseline [Heightb]. I wanto to allow children of different ages to have different slopes (older children should gain more speed compared to younger children). Finally, I want to control for the random effects of examination date [Date] and treadmill used to measure the speed [TreadmilId]. Date and Treadmill are time-varying.

I thought a repeated measures mixed effects model would be appropriate for this research question. What should be the notation in lme4 then?

Would the below notation be good?

Speed ~ Time*Country + Ageb + Heightb + Weightb + (1+Ageb|SubjectId) + (1|Date) + (1|TreadmillId)

Alternatively, if I treated Age, Weight, and Height as time varying covariates, could I use the following notation:

Speed ~ Time*Country + Age + Height + Weight + (1+Ageb|SubjectId) + (1|Date) + (1|TreadmillId)

I would be greatfull for alternate approaches to the problem as well.

Best, Adam

## 1 Answer

Answer in two steps. First, data transform testing. Second, model fit testing.

Concerning data transformation, from prior work for the type of data the OP has offered, neither model is appropriate. Body scaling is not linear, so linear models are not as useful as logarithm transformed data and variables, which leads to power function formulas. For power function body scaling examples see Klieber's law, and Adolph EF (1949) Quantitative relations in the physiological constitutions of animals. Science 109:579-85, or more relevant to your question articles of the fractal stride length and similar type. Thus, transform your variables and data by taking their logarithms, which will reduce heteroscedasticity, improve correlation, and improve goodness of fit. When that is done, the resulting formulas are power functions. If you wish more detailed information as to how and why to do this, I would suggest reading this example. From that example, note the improvement that taking logarithms provides for body scaling: For the second point, exhaustive model testing is required for best formulas, and the first thing that comes to mind is infrequently the best. From the example, compare the Bland-Altman plots below for the theory that glomerular filtration rate is scaled by body surface area (Haycock formula; a power function of Weight and Height) versus a power function of extracellular fluid volume and weight. Note the reduction of both $$y$$-axis variability and trending over the $$x$$-axis range using the better, $$f(V,W)$$, formula. Finally, to identify which formula is best, a lot of testing should be performed for an exhaustive list of variable combinations using multiple tests, like Bland-Altman and others (ANOVA F-test and partial probabilities, multicollinearity, adjusted R$$^2$$, $$p$$-testing of residual distributions type using multiple tests then one can hopefully use AICc, BIC and other ML tests, and so forth.) It takes a lot of work to get good answers, but without doing the work, the results may never be used by other authors, worse if they are actually used by others and are misleading.