I'm currently working on a nested data set consisting of 100 subjects which answered several questions at home on five consecutive days (ecological momentary assessment). Among them, they were asked if they adhered to the study protocoll on each given day (no/ yes), leading to 0 (no) or 1 (yes) in the data for each of the five days. The continous outcome variable was also assessed on each day.

The reserach question is whether beeing adherent on a given day has an effect on the outcome. Now, to explore the effect of the adherence on the outcome variable, I built a nested multilevel model (days within subjects) predicting the outcome by some covariates, a random intercept (high ICC) and the variable coding for adherence (0 or 1).

Normally, I would proceed and disentangle within-subject variations (person mean centered) from between-subject variations (grand mean centering of the person means) for the adherence variable. However, it seems rather odd to me to center a dichotomous variable. On the other hand, I know that it is necessary in order to get a clear picture of the within-subject effect. When not centering, I could enter the 0/1 adherence variable as a factor. However, in this case, it would confound within- and between-subject variations (because subjects do not only differ as compared to themselves but also in their total amount of adherence in comparision to the group, the grand mean).

Do you have any advice on whether I should center the 0/1 variable? If yes, how would you center? If no, how would you proceed?

Dear Erik (and everybody else interested), I know it has been a year or so but I have a follow up question and I think you could maybe help me with that, too:

I now have decided to add the dichotomous predictor as centered on the person means. Just as you predicted, when the person mean is added to the model, I geht within-subject effects for both variants (person-mean centered and person mean vs. 0/1-factor and person mean). Both variants are yielding exactly the same results.

I now have also added an interaction of the person-mean centered variable with a grand-mean centered covariate (person means centered at the grand mean). So far so good. However, I just tried and refitted the model with the dichotomus factor (0/1-factor) instead of the person-mean centered predictor and the interaction term changes drastically.

Do you have any idea why?

In short, it looks something like this:

y = x (as a factor with 0 / 1) * z (grand mean centered person mean of z) + x (person mean of x)

y = x (centered on the person mean) * z (grand mean centered person mean of z) + x (person mean of x)

Both interactions are giving me different results.

Thank you very much in advance!

  • $\begingroup$ What would make you center a continuous variable? $\endgroup$ Dec 24, 2021 at 13:08
  • $\begingroup$ Hi Frank, thanks for the follow-up question. There are several cases where centering is essentiell to understand the effects in longitudinal (repeated measures) data. In brief, I need to make sure that within- and between-person effects are separated. Otherwise, the effects would be an uninterpretable blend of these two sources. See the following book for more in-depth information: Raudenbush, S., & Bryk, A. (2002). Hierarchical linear models (2nd ed.). Thousand Oaks, CA: Sage. $\endgroup$
    – endopsy
    Dec 26, 2021 at 10:56
  • $\begingroup$ I'm trying to think of a situation where the model is well-specified, you have sufficient replicates at all levels, and you need to center to be able to get separate effects. Right now I can't think of one except for this: you have interactions and want to use primary parameters instead of forming contrasts of interest. $\endgroup$ Dec 26, 2021 at 13:28
  • $\begingroup$ Centering can help to understand interaction effects and their lower order effects, but also the effects of the intercept (in case it is of interest), and can reduce collinearity (at least mathematically). In longitudinal multilevel models, where subects have multiple observations (sometimes across several days or weeks), the fixed effects are not interpretable if the effects are not seperated into between- and within-subject variances (e.g., by person-mean centering and grand-mean centering of person-means). In classical regression models, centering is not that important (in my opinion). $\endgroup$
    – endopsy
    Dec 27, 2021 at 16:34

1 Answer 1


One option would be to calculate the person mean (across all occasions) of the 0/1 predictor. When you add that to the model along with the uncentered 0/1 time point specific variable, the time-point specific coefficient at level 1 is exactly equivalent to the coefficient you would get if you centered it around the person's mean. This is due to the shared variance, which you have removed, between the level 1 (uncentered) and level 2 (person mean) of the 0/1 variable. Some folks refer to the level 2 coefficient for the variable as a measure of the "contextual effect" of the 0/1 predictor. In a longitudinal model this is a weird way to think about the level 2 variable; it makes much more sense (to me at least) in the cross-sectional case.

tl;dr: calculate the person mean of the time-varying variable and enter it into the regression model along with the uncentered 0/1 variable. Now you've got a coefficient at level 1 that has a within-person interpretation!

  • $\begingroup$ Thank you for the reply! I just tested this theory and the p-value is the same as when centering on the person-mean. However, the coefficient is slighty different in both cases (uncentered predictor and its person mean vs. directly centered on the person-mean). Do you have an idea why? $\endgroup$
    – endopsy
    Nov 12, 2019 at 16:13
  • $\begingroup$ They should be exactly equivalent. Is the N changing across regressions? Try running the two models only with these these variables (nothing else): 1) uncentered L1 + person mean and 2) L1 centered around person mean + person mean. Make sure the N is the same across regressions. $\endgroup$
    – Erik Ruzek
    Nov 13, 2019 at 18:37

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.