4
$\begingroup$

Just assume a situation like this: "A" is the independent variable, which is as both between- and within-level. "B" is another independent variable, which is only as within-level. "C" is the outcome variable, which is also within-level.

If I use lmer directly adding A as a random factor, then only the grouping variance can be estimated. i.e., m1 <- lmer(C ~ A + B + (1 + A | Grouping), data = data

However, I would like to estimate the specific grouping fixed effect on the outcome variable (rather than just know the variance of slope and intercept). Then, my question is, is it appropriate to do like the following steps?

  1. Create a group-mean variable A_1 and a grand-mean variable A_2 using the misty::center function.
  2. Revise the formula and code as m2 <- lmer(C ~ A_1 + A_2 + B + (1 + A_1 | Grouping), data = data
  3. Then, the fixed effect of A_1 is simply within-level effect, and the fixed effect of A_2 is the group fixed effect, e.g., to what extent an improved environment may predict better individual performance.
$\endgroup$
3
  • $\begingroup$ Can you clarify what does it mean specifically that A is both between- and within-level? And how does A_2 differ from the initial "between-level A"? And, I'm not sure I understand correctly, but if you want the fixed effect of grouping on outcome, you should have grouping as a fixed predictor instead of random effect grouping factor. $\endgroup$
    – Sointu
    Commented Jan 19 at 9:17
  • $\begingroup$ @Sointu Thank you. Assume A as a variable indicating students perceived classroom climate, thus it may vary within classroom and between classrooms. Yes, A_2 is the grand mean of A, meaning that each classroom has a single A_2. Therefore, as you said, A_2 is only added as a fixed predictor. But, A_1 is the group mean of A, meaning that the individual score within a classroom is centered by the mean score of the classroom and z-standardized. Thus, this is added as both fixed and random predictors (This is exactly what I want to achieve in the second step). Does this make sense to you? $\endgroup$
    – Enmi
    Commented Jan 19 at 16:30
  • $\begingroup$ Yes. I see now, thank you! Your model makes sense to me intuitively but I'm not sure about the statistical implications. $\endgroup$
    – Sointu
    Commented Jan 19 at 16:57

1 Answer 1

4
$\begingroup$

This is a great question that hits at one of the superpowers of multilevel or mixed effects models, in my opinion. In your example, A, B, and C all vary within groups but, very likely, groups vary in their mean level of each of these. The model does a decomposition of the outcome (C). We can see this in the level-specific formulation of these models:

Level 1 (within-group): $y_{ij} = B_{0j} + e_{ij}$

Level 2 (between-group): $B_{0j} = y_{00} + u_{0j}$

The decomposition comes out in the two error terms, each of which are drawn from non-correlated normal distributions, the variances of which the model provides estimates for:

$u_{0j}$ ~ $N(0, \sigma^2u_{0j})$; $e_{ij}$ ~ $N(0, \sigma^2e_{ij})$

So the model does this automatically for the outcome, but it is up to the analyst to least investigate it for the predictors. The way that we do so is to split predictors into their within- and between-components. As you indicate, there are functions for this, but I use dplyr

dat <- dat %>% group_by(cluster) %>% mutate(mn_A = mean(A), mn_B = mean(B)) %>% ungroup()

Just adding these variables to the model, in addition to the original versions, does the separation.

m1 <- lmer(C ~ A + mn_A + B + mn_B + (1 + A | Grouping), data = data

Algebraically, the coefficients on the mn_* variables are a test of whether the within group association differs from the between group association for that variable. The original variables provide the within-group estimate of the association.

But as detailed in Enders & Tofighi (2007), an ideal approach is to do what you suggested and subtract the group mean from the original variables. They termed this centering the variables within clusters (cwc):

dat <- dat %>% mutate(A_cwc = A-mn_A, B_cwc = B-mn_B)

And then running the mixed model with these group-mean centered variables in addition to the group mean variables:

m2 <- lmer(C ~ A_cwc + mn_A + B_cwc + mn_B + (1 + A_cwc | Grouping), data = data

This leads to exactly the same interpretation of the uncentered A variables in m1 and the mn_* coefficients become the between group associations for those variables. This corresponds to your interpretations in #3.

Edit: Another great paper in the context of education and student surveys is one by Lüdtke et al (2009).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.