# Cross-level correlations in a Multilevel Model

I'm currently running a daily diary study, where participants first complete a baseline survey and then complete the same survey each day for 10 days. My data has a nested structure (days nested within persons), where the measures assessed in the daily surveys are at level 1 (within-person level) and the measures assessed in the baseline survey are at level 2 (between-person level). I'm trying to identify which variables to control for in my multilevel regressions. I understand that we generally want to control for variables that correlate with the predictors and outcome in the model. I want to assess if I should control for any level 2 variables in my model (e.g., gender, age, ethnicity, etc.) but I am unsure how to obtain correlations between level 2 and level 1 variables. I was wondering if anyone may have an idea of something I could try?

• This should work via interactions between respective level 1 and 2 variables for which you assume interrelations. So I would search for 'interaction effect', if you are not familiar with this.
– timm
Commented Aug 30, 2022 at 7:46

## 2 Answers

To my knowledge, there is no clear-cut way of obtaining basic correlations between L1 and L2 variables. You can run preliminary multilevel regression(s) with your outcome as the dependent and your L2 potential covariate(s) as predictors to see if they are related. But I don't see a problem in just adding the covariates that are theoretically meaningful into your main model. One way to analyze and report data like this is to run and report several models, for instance one with no covariates, one with demographic covariates, and one with demographic + other possible covariates, and report all of these in parallel in the same table.

Your question reminds me of the following. An L1 predictor X can be split into two components, a between component $$X_B$$ and a within component $$X_W$$. The between component is constructed by taking the average of all X values for a given person. In R:

XBetween <- ave(X, id)


XBetween is a new variable with as many values as X has; if a person has 10 values over time for X, then XBetween contains 10 values, all equal to the average of X for that person. Next, the within component $$X_W$$ is created by:

XWithin <- X - XBetween


If there exists a correlation between some L2 variable, say Age, and X, this can only be because there is a correlation between $$X_B$$ and Age. If you would use as model:

$$Y = b_{0j} + b_BX_B + b_WX_W + b_3Age + b_4Gender + ...$$

then $$b_W$$ gives you the so called within-effect of X: what happens with Y if X increases 1 unit within a given person! On the other hand, $$b_B$$ shows what happens with Y if the average of X increases 1 unit, being a between-person interpretation.

The $$b_W$$ effect cannot be confounded by your L2 variables, but $$b_B$$ can, if there exists a correlation of the L2 variable and $$X_B$$! So you may want to check for such correlation.

The within effect $$b_W$$ is often considered to be more interesting than the between effect is. Suppose you would use dummies for you persons (instead of the random $$b_{0j}$$). Then you would not be able to include Age en Gender of course, but only X, and the effect of X would then be equal $$b_W$$, as it is the effect controlling for person.

These kind of multilevel models for longitudinal data are called "hybrid models" or "within-between models". See Paul Allison's blog on hybrid models