# How to analyze between-group differences in within-group variances over time in a 3-level model?

The data I am using is collected within the physical fitness surveillance program in schools. In these schools, either no intervention, healthy lifestyle intervention, healthy schools network intervention or both interventions were employed. We divided the children by weight status into 3 groups, i.e., children with normal weight, overweight or obesity. Physical fitness tests that were included measured different components (e.g., broad jump, 600-m run, backwards obstacle course, etc.) every year at equally spaced time intervals (10 time points in total). Therefore, in my study, I considered if, over time (10 equally spaced time points), there are possible between-group (i.e., no intervention, healthy lifestyle intervention, healthy schools network intervention, both interventions) differences in the changes of within-group (children with normal weight, overweight or obesity) variances. I am having trouble finding an appropriate approach since I am not only interested in the changes in means but also in variability over time. Specifically, the research question is aimed at answering if different interventions increase/decrease/have no effect on the disparities in physical fitness test score variability between groups of children separated by weight status (children with normal weight, overweight or obesity). I also have information on the school level, so I would like to account for that and represent this as a multilevel (3-level) model.

In my data, I have 475 155 observations across 264 642 individuals divided into two age groups (older and younger, equally divided). Across different time points there are this many observations: 0: 71033, 1: 85154, 2: 85984, 3: 87332, 4: 90888, 5: 96551, 6: 101337, 7: 106451, 8: 104671, 9: 80931. There are also 452 unique schools at level 3.

I have constructed a model (divided by sex) with all predictors of interest (time point is continuous with a range from 0-9; pheight is height percentile and is included to account for differences in maturation) in an MLM framework by using the nlme package in R:

full_modelboys <- lme(pr600 ~ 1 + (time_point + I(time_point^2))*weight_status*intervention + age_group + pheight,
random = ~ 1 + (time_point + I(time_point^2)) | school/unique_id,
data = df_boys,
na.action = na.omit,
method = "ML",
control = lmeControl(opt = "optim"))


Thank you very much in advance, even for just reading the question to the end, because I think I could not complicate this more beautifully!

Your current model is focused on the means with variances at the between person (and school) level. The fact that you are estimating separate models for boys and girls is interesting and is one way to approach the issue you want to address below,

Specifically, the research question is aimed at answering if different interventions increase/decrease/have no effect on the disparities in physical fitness test score variability between groups of children separated by weight status (children with normal weight, overweight or obesity).

I think ultimately there are a lot of directions you could go to address this. One quick way would be to fit the model in your original post separately for the three groups of interest. This would give you separate (mean) estimates of the treatment effect and then separate residual (within-person) variances. You could look at the relative sizes of these to determine whether one of the groups experiences more or less variability in the outcome.

If you want to formalize this in a single model, then you need to look into heterogeneous variance models or mixed effects location scale models (MELSM). These allow you to fit models (predictors) to the residual variance term. Really sophisticated versions of them can be readily estimated in brms whereas simpler ones can be estimated with lme(). See the links below for more info.

https://quantdev.ssri.psu.edu/sites/qdev/files/ILD_Ch06_2017_MLMwithHeterogeneousVariance.html

https://cran.r-project.org/web/packages/brms/vignettes/brms_distreg.html

https://rstudio-pubs-static.s3.amazonaws.com/593838_838639e42b1643df9886a26cb922ab05.html

• your answer is certainly helpful and interesting. I also received a suggestion to read the following paper and the approaches described: link. I am a big podcast fan and I've also found a lot of help on this episode of the Quantitude podcast: link. Based on all the reading and research I've done, I'm still not sure which approach to choose. I am pretty careful since this study is part of my PhD project but I fear that I am stuck in an analysis paralysis state. Commented May 31 at 16:34
• That's an interesting paper and approach. But honestly, it feels like a distraction. You can do what you want using mixed models. Especially if you move over to brms, you can do some really cool stuff. Personally, I would invest my time building on the foundation you already have (porting it over to brms) over learning a new method that doesn't move the needle that much. Commented May 31 at 18:37