I am trying to find a way to preprocess my data. The data is as follow:

study person_id energy_1 energy_2 y
study_id A 2.3 -1.05 1
study_id2 B 1.03 0.04 0

Statistically speaking, we can see that for each study, the value of energy_1 and energy_2 brings a lot of value to determine wether the person is 0 or 1 in the y column: We can mostly only use them to make the prediction. But when we are using the whole dataset and mixing the studies together, the model used (a binary XGBoost classifier) is no longer able to properly predict the label.

Can you give hints on how to preprocess/transform my data so that the model could react properly independently of the study?

I am aware that XGBoost do not need normalized data.

  • $\begingroup$ what doe you mean by "value of energy_1 and energy_2 brings a lot of value"? $\endgroup$
    – lpounng
    Nov 17, 2022 at 10:52
  • $\begingroup$ They have a high predictability power. I edited the post :) $\endgroup$
    – DueSouth
    Nov 17, 2022 at 12:51
  • $\begingroup$ How do you figure that those features have a lot of predictive power when the predictions they make are inadequate? $\endgroup$
    – Dave
    Nov 17, 2022 at 13:48
  • $\begingroup$ First test I would do is confirm your hypothesis. You believe that energy_1 and 2 have power for each study. Dave is asking about that above. Separate the data into each study and build a model on each study by itself. Prove your hypothesis. The separate models by study are obviously independent of the study. $\endgroup$
    – Craig
    Nov 17, 2022 at 14:20
  • $\begingroup$ This part has already been done: I created models for the different studies and it works great. But when the data is merged, since the those two variables are not anymore useable. The range of the data differs. $\endgroup$
    – DueSouth
    Nov 17, 2022 at 15:13

1 Answer 1


I would use mixed effects logistic regression here; it was designed and built for things like this. Y is binary here per comment so you can use logistic regression. Energy 1 and 2 should the fixed effects here; we want to know the effect of increasing energy_1 by 10%. The random effects can be person_id and study. Person and study are just a collection of potentially infinite possibilities. We don't care what the "effect" of having person A vs Person B taking the test. By treating them as Random effects, we save degrees of freedom and can estimate the effect of energy better. Finally, note mixed effects logistic regression has a unique interpretation you should know: https://stats.oarc.ucla.edu/r/dae/mixed-effects-logistic-regression/#:~:text=Mixed%20effects%20logistic%20regression%20is,both%20fixed%20and%20random%20effects.

  • $\begingroup$ Thanks for your answer @user70889. I'll definitely explore that solution. In the meantime, I created different models for the different source of data/ different study to prove the point that there is indeed some predictability. $\endgroup$
    – DueSouth
    Nov 21, 2022 at 7: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.