Let me define the problem space.

I am working a binary classification problem. I am trying to build a causal model as well as predictive model.

My aim is to find list of significant features (based on causal model) and use that to build a predictive model. I did refer the suggestions provided in this post and it was very much useful but I have few more questions due to my limitations with ML field.

I understood from literature that there are two ways to adjust/control for confounders. one is through study design phase and other is during modelling/analysis phase.

As I am working on retrospective data analysis, I can only adjust confounders during analysis phase.

We know that certain features like Age in a typical example like "gender causes heart disease" is a confounder.

1) So during analysis phase, we include age as a variable in our model. Similarly all the potential confounders that we could think of are put in the model as features. ex: X_train will have all the columns/features that I think of as potential confounders and then it is fed to the model (logistic regression). Am I right till here?

2) Does this mean our LR model is adjusted for confounders? How would you do confounding adjustment during logistic regression modelling phase? If we include all potential confounders in our model and if the coeff of already existing variables (gender) change by 10% or so, I understand that age is a confounder but does this also mean that LR is adjusted for confounders?

3) Then, why it is said that logistic regression doesn't consider feature interaction? Is feature interaction different from confounding? I understand that feature interaction is usually denoted as gender*age but does this mean both variables work together to influence the outcome? doesn't confounder mean the same?

4) What's the usefulness of having interaction variables? I mean if gender*age impacts the outcome, can I understand that gender (individually) and age(individually) impact the outcome?

5) I see that people usually create 2x2 tables called as strata for stratified analysis and compute risk ratio and compare it with crude risk ratio. But how can we do this for all variables which I think as confounders in my dataset? I know we can use tools like SPSS, STATA etc but is it the only way to do? But then can't we do using multivariate regression?

6) Is it mandatory that all our continuous variables be converted into some categorical variable for analysis/confounder adjustment?

7) Any simple examples/explanation would be helpful as I couldn't find any tutorial for adjusting confounding during logistic regression and finding significant variables. I have been referring this though it's useful, some links are broken. lot of questions arise because I am neither a stats or biostats person. I usually build models using classic ML algorithms and now trying to learn all this.

Can you help?

  • $\begingroup$ 'confounders': people who smoke often also drink alcohol. Interactions: the health effect of smoking is worse if you also drink...(made up example) $\endgroup$
    – seanv507
    Jan 2, 2020 at 7:07

1 Answer 1


There is a lot to unpack here, so I'll just answer a few of these.

Confounding occurs when a predictor and the outcome share a common cause. Usually, the presence of unadjusted confounding yields a biased estimate for the relationship between the predictor and the outcome. If you are building a predictive model, you don't need to think about confounding because you are not interested in attaining unbiased estimates of the coefficients in the regression model; you only care about building a model that predicts the outcome well. If you are interested in the causal effect of a focal predictor on an outcome, then you need to think about confounding. There are many ways to adjust for confounding, but I won't go into them here because it seems like you're actually more interested in prediction.

An interaction means that the relationship between a predictor and the outcome depends on the value of another predictor. For an age-by-gender to interaction to be present is for the relationship between age and the outcome to depend on a patient's gender. This is completely unrelated to confounding. You can have two completely randomized exposures (e.g., whether drug A is taken or not, and whether drug B is taken or not) which may interact with each other on the outcome; there is no confounding because the exposures and the outcome do not share any common causes. When model building, interactions between predictors might be valuable, but it depends on the specific situation. Interactions with age seem plausible in medical applications, but often weak predictors will not meaningfully interact with other predictors. You can use variable selection methods like lasso to determine if specific interaction terms would be valuable in a predictive model.

You don't need to make continuous variables categorical, but it can sometimes help when the relationships between predictors and the outcome are highly nonlinear. In general, it's better to use a flexible model that accounts for potential nonlinearities than to artificial discretize continuous variables.

  • $\begingroup$ Hi, Thanks for the response.Upvoted. But am trying to build a predictive model based on causal features. $\endgroup$
    – The Great
    Jan 2, 2020 at 3:41
  • $\begingroup$ That doesn't change anything. If you are not estimating a causal effect, you don't need to think about confounding. If you are trying to estimate a causal effect, you can only do that with one focal predictor (e.g., the causal effect of a specific drug), not with a model that explains how all the features causally affect the outcome. It sounds like you haven't decided which of these two you want to do, but you have to choose one. $\endgroup$
    – Noah
    Jan 2, 2020 at 3:47

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.