# Why and how to match variables in logistic regression?

I have a dataset of ~4.7K records focused on binary classification with 60 features. class 1 is of 1554 records and class 2 is of 3558 records.

Now I would like to find the risk factors that influences the outcome which is disease present or not. This is a supervised learning problem

I understand that people do matching to ensure that both the classes have similar distribution, so that the comparison results are reliable.

1) I see people usually do matching based on demographics like Age etc. Is it to infer what factors really influence the outcome if we keep Age constant. Am I right to understand this way?

2) If I put all the variables in logistic regression model, doesn't that account for confounding? Why do I have to do matching?

3) Out of 60 features, I would like to do matching based on 4 variables. How do I do this for my full dataset? Is there any python package to do this?

Can someone help me on how to do this?

• can you clarify the first question? What is the question exactly? Jan 6, 2020 at 23:25
• I figured out that. It is here In epidemiology, the term “exposure” can be broadly applied to any factor that may be associated with an outcome of interest Jan 6, 2020 at 23:26

It appears (if I understand you correctly) that you want to model the causal effect of some confounders $$X$$ on some outcome $$y$$ by using Logit. If this is correct, and if you know the outcome $$y$$, you should be fine with using just Logit, because in this case (and if you are able to contol for all relevant confounders $$X$$), you can identify the marginal effect of $$x$$ on $$y$$.
I guess you refer to "Propensity Score Matching" (PSM) in your question. This technique is used to "predict" cases in which you do not know for sure if some $$i$$ would have received treatment ($$y=1$$ or $$y=0$$) and you try to "predict" this outcome. In other words: The propensity score is the conditional (predicted) probability of receiving treatment given some $$x$$.
However, in case you observe $$y$$, and in case you don't have rasons to believ that there is a bias in $$y$$, you should be fine with a normal Logit. Here it would be really important for you to clarify what your problem actually is (this is not clear from your question). So if treatment ($$y$$) is non-random, you may think about "correcting" this bias using PSM. If not, you can go with normal Logit.
Anyway: PSM has it's pros and cons. It also is a little outdated since matching has made huge progress in recent years. So the most important thing for you to do is - as it appears to me - to get a good idea if you really need to "adjust" the treated/non-treated $$y$$ (so if you have reasons to believe that the data generating process is biased or non-random).
• Hi, thanks for the response. Upvoted. I am trying to find the risk factors that influence the outcome (disease present or not). I have the y` values known before.Like you said, yes I did logistic regression with all input variables in the equation meaning it adjusted for confounders and no need to do for matching. Am I right? Jan 6, 2020 at 23:42