# All mixed effects coefficients are incorrectly positive in lmer lme4

I have data from a simple intervention design (n=500), where participants were measured across a number of (continuous) outcome variables at pre- and post-intervention (there was no control - not my choice). I have used lmer (from the lme4 package) to specify a mixed-effects model (one for each outcome of interest) that captures the change from pre to post (treating pre-intervention varAPRE as a predictor of post-intervention score varAPOST) whilst partialling out the contribution/variance of a number of random effects (e.g., school of the participant (1|School)).

Each model looks something like this:

model = lmer(varAPOST ~ varAPRE + (1|School), REML = FALSE )


The issue i'm having is that the coefficient for the fixed effect varAPREseems to always be positive regardless of the direction of change from pre to post intervention.

For example, the two-tired CI plot (see below) shows varA to decrease from pre to post (as hypothesised) - the mean change is -2.79. However, the model summary for the fixed effect is as follows:

 Fixed effects:
Estimate Std. Error        df t value Pr(>|t|)
(Intercept)       22.97028    1.99319 345.70193   11.52   <2e-16 ***
varAPRE         0.49146    0.03598 463.48463   13.66   <2e-16 *** Likewise, if I run a similar model for a different outcome variable, one where I expect an increase from pre to post (e.g., varB), see plot below.

model2 = lmer(varBPOST ~ varBPRE + (1|School), REML = FALSE )


I get the same coefficient direction in the output:

Fixed effects:
Estimate Std. Error        df t value Pr(>|t|)
(Intercept)        27.54412    1.80938 280.17582   15.22   <2e-16 ***
varBPRE        0.47579    0.03613 468.95373   13.17   <2e-16 *** I am completely confused by this. It doesn't make any difference if I switch the order of pre and post in the model (one to the outcome, one to the predictor) or whether the pre-intervention score is centered or not. Everything in the model output looks correct, with the exception of the direction! Any help/clarity would be much appreciated.

Here are two plots varAPRE/varAPOST and varBPRE/varBPOST (coloured by school) which help to make sense of the coefficients in each model highlighted above: • The reference level is important in factors, it would appear that varAPost is the reference level in the first plot, hence the positive coefficient for Pre. I don't know what is happening in the second plot, what is Relatedness..PRE.? Oct 10 '18 at 9:28
• sorry, that should be varBPRE. I've now edited it. varA and varB are continuous variables not factors. Oct 10 '18 at 9:33
• Are you sure the plots are right? Oct 10 '18 at 9:41
• Yes, positive. I've also calculated the mean difference by hand and it confirms the direction of the plots. Additionally, there are 12 outcome variables and each plot confirms the hypothesised direction of the intervention effect. 5 positive, 7 negative, but the coefficients are all positive in the output. Oct 10 '18 at 9:45
• I may be wrong but the plots don't seem to be a good representation of your model. Your model says that a higher pre-score is associated with a higher post-score, not that the post score is lower than the pre-score. What do you see if you do plot(x = varAPRE, y = varAPOST)? (or better yet in ggplot with points colored by School). Do you get the positive association reflected in the model?
– Niek
Oct 10 '18 at 10:10