Hello,
I am doing multilevel logistic modelling (Stata 17.0) and my question regards to using mean centered variables in melogit-command.
The problem is that Stata does not allow me to add my centered categorical variable in the model. My centered variable has values such as -1.13 and 0.87.
Error:
centered_predictor_var: factor variables may not contain noninteger values
After this I realised i-prefix is not allowed if values are non-integers. Now I am wondering, whether there is any way of adding centered categorical variables, which have non-integer values, to the melogit command?
One solution would be to treat these centered categorical variables as continuous, and add them without i-prefix, but I have doubts about this method.
I am aware, that there is some discussion whether categorical variables should be centered or not (see literature list below). However, I would like to try it at least, if I find a solution to this issue.
Thank you!
Literature:
Hox, J. J., Moerbeek, M., & van de Schoot, R. (2010). Multilevel Analysis: Techniques and Applications, Second Edition. Taylor and Francis. https://doi.org/10.4324/9780203852279 (pp. 59-63)
Yaremych, H. E., Preacher, K. J., & Hedeker, D. (2021). Centering categorical predictors in multilevel models: Best practices and interpretation. Psychological Methods. https://doi.org/10.1037/met0000434
I am doing multilevel logistic modelling (Stata 17.0) and my question regards to using mean centered variables in melogit-command.
The problem is that Stata does not allow me to add my centered categorical variable in the model. My centered variable has values such as -1.13 and 0.87.
Code:
melogit my_response_var i.centered_predictor_var || level2_indentifier:, or
centered_predictor_var: factor variables may not contain noninteger values
After this I realised i-prefix is not allowed if values are non-integers. Now I am wondering, whether there is any way of adding centered categorical variables, which have non-integer values, to the melogit command?
One solution would be to treat these centered categorical variables as continuous, and add them without i-prefix, but I have doubts about this method.
I am aware, that there is some discussion whether categorical variables should be centered or not (see literature list below). However, I would like to try it at least, if I find a solution to this issue.
Thank you!
Literature:
Hox, J. J., Moerbeek, M., & van de Schoot, R. (2010). Multilevel Analysis: Techniques and Applications, Second Edition. Taylor and Francis. https://doi.org/10.4324/9780203852279 (pp. 59-63)
Yaremych, H. E., Preacher, K. J., & Hedeker, D. (2021). Centering categorical predictors in multilevel models: Best practices and interpretation. Psychological Methods. https://doi.org/10.1037/met0000434
