# What regression model to use for both repeated measurements and cluster data (and how to do it in R)?

My research question involves looking at association between the characteristics of neighborhoods (% male, % female, income, % young people, % old people) and the participation rate in a programme (% -continuous).

The participation rate for each neighborhood is measured every year, and also the characteristics of neighborhoods change every year too (people in and out, are born and died, income changes) -> Repeated measurements.

At the same time, the neighborhoods are within provinces, cities and are believed to share some similarities -> I also have clustering in my data.

Could you please give me suggestions on which regression model to use in this case with both repeated measurements and clustering for continuous outcome? And if possible, which R command to use and what I need to specify in the arguments in R command to show the repeated measurements and clustering being taken into account.

Thank you!

From the description, you have multiple measures within neighborhood , with neighborhoods clustered within cities, and cities within provinces.

Thus you would want to fit a multilevel model, which is just a special case of a mixed effects model. In R the model formula would look something like

participation ~ covariates + (1 | province/city/neighborhood)


This will fit random intercepts for province, the city:province interaction, and the city:province:neighborhood interaction which will account for the clustering/non-independence/repeated measures at each level.

However, a word of caution, since you are talking about rates you need to be careful that you are not invoking bias due to mathematical coupling if you divide a variables on the left side of the formula and the right side of the formula by another variable (such as population).

• Thank you very much for your suggestion, Robert. For one neighborhood, I use the same denominator for the dependent variable and the independent variables, which is the population of that neighborhood. It's what you noted in the last part of your answer, right? I would wish to ask a bit more. In your answer, you did not talk about the repeated measurement part (the outcome and covariates are measured every year). My concern is that can linear mixed model take into account both repeated measurements and clustering and how to put those in the arguments in R function. Thanks in advance! – Ngan_Tran Feb 2 at 21:24
• @Ngan_Tran On the contrary. I said it will "account for the clustering/non-independence/repeated measures at each level.". By including neighborhood as a grouping factor in the random intercepts part of the formula in my answer, it is allowing for repeated measures within neighborhood. If neighborhood was only measured once then it would not be included there. – Robert Long Feb 3 at 6:48
• ...A much bigger problem is dividing the the dependent variable and independent variable by another variable. This can invoke a large spurious correlation, which would otherwise be absent. – Robert Long Feb 3 at 6:50
• Thank you very much Robert Long. I always have the question whether repeated measures and clustering are presented in the same way in the R command. Just to confirm, the answer is yes, right? (province|city|neighborhood in this case) – Ngan_Tran Feb 13 at 22:45
• "A much bigger problem is dividing the the dependent variable and independent variable by another variable. This can invoke a large spurious correlation, which would otherwise be absent": I was thinking of checking whether clustering is truly present in my data (whether towns are truly clustered within provinces). If it is not the case, I will just take repeated measures into account, then can avoid introducing spurious correlation as you mentioned. Could you please give me suggestions on a technique for checking whether data are clustered by a specific variable? Many thanks in advance! – Ngan_Tran Feb 13 at 22:48