# Why does centering variable A influence my p values of factor B in the linear mixed effects model?

I have a dataset, where I would like to see whether there is a group difference in the measurement "concentration". I have repeated measurements for some subjects, which is why I use a mixed-effects model to account for the within-subject repeated measures. From my literature, it is clear, that "concentration" is age-dependent, which is why I end up with the following model:

concentration = intercept + study_group * age, random intercept: subject

concentration is numeric and has values from 0 - 2
study_group is a factor with 2 levels
age is numeric and has values from 36 to 48


I followed a tutorial (https://ourcodingclub.github.io/tutorials/mixed-models/) that recommended to standardize (centre) my explanatory variable and centred my age variable.

Using the centred age variable, my mixed-effects model showed a significant p-value for the study group, but the model with the uncentred age did not show a significant p-value for my study group.

While looking at the summary of the models I noticed, that Intercept and study group changed values but not the age or interaction term.

I know would like to understand why this is the case.

The issue you described is most likely due to fitting an interaction with the variable in question. When a variable is involved in an interaction it's main effect is conditional on the other variable it is interacted with being zero. So, in your case, you have an interaction of age with study_group. So, the main effect for study_group is conditional on age being zero. When you centre age at it's mean, zero then becomes the mean on the original scale. Centering the variable makes a lot of sense in this case, otherwise the main effect for study_group would be conditional on an actual age of zero, which presumably does not make sense in the context of your study (otherwise you wouldn't want to centre it). Naturally these are two different tests, and will therefore have different estimates and p values.