It is my understanding that when predicting from a multiple regression model with continuous predictors, the other predictors are often fixed at their mean. What is the equivalent method for a model with all categorical predictors?

I am running a GLM of the form:

continuous response variable ~ categorical predictor1 + categorical predictor2 + categorical predictor3

So, my question is, how do I fix categorical predictor1 & categorical predictor2 at their mean values to determine the effect of categorical predictor3?

I suspect that the answer may relate to the coding of my categorical predictors. Currently, they are 2-level and 3-level factors that are coded as text (e.g., Age has two levels, Female and Male). Do I need to re-code 2-level categorical predictors as 0,1 and 3-level categorical predictors as 0,1,2?

***Note that my original plan was to use emmeans to compare means between groups for a single model. But it turns out there is substantial model uncertainty among the models in my candidate set (several models with delta AIC <2), and it is common in my field (ecology) to make inferences based on model-averaging in this scenario. To my knowledge, emmeans is not fully equipped to produce means and contrasts for model-averaged objects. Therefore, I think I need to employ the predict.averaging function from MuMIn to get model-predicted means, but this involves holding some variables constant at their means (see example of what I mean here: https://rdrr.io/cran/MuMIn/man/predict.averaging.html).

Any advice would be very much appreciated.


1 Answer 1


It does not make much sense to take the average of a categorical predictor.

It would be better to set the values of Pred 1 and Pred 2 to some "typical" values, say their modes, and then draw the graph of the effect of Pred 3. Unless you have interactions, the graph will look the same to matter which values you set Pred 1 and Pred 2 at; just the vertical scale will be different (shifted).

If you have interaction, say between Pred 1 and Pred 3, you can set Pred 2 to its mode and draw an interaction plot. If Pred 2 does not interact in you model, then the graph will look the same no matter which value you set Pred 2 at, again the vertical scale will be shifted.

If you have a three-way interaction, then the two-way interaction plots will look different for different values Pred 2, so you should draw all of the interaction plots, one for each Pred 2 value, in order to understand the meaning of the three-way interaction.

See "interaction.plot" in R for a good graphical display.

  • $\begingroup$ Thank you very much for clarifying. Your answer is exactly what I was looking for. $\endgroup$
    – MoriahT
    Dec 11, 2020 at 20:55

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.