# How to improve model fit of my predictive model?

I am building a predictive model and hope to improve its model fit. I have 2 predictors, BMI (continuous variable) and smoking status (binary variable), and my outcome is disease status (yes/no).

Can someone please share how we can improve the model fit? I can only think of two possible approaches: 1) log transformation and 2) adding interaction or squared terms. Are there any other ways we can try?

• It is a broad question and we have few information… what have you done so far ? Have other variables to include in you model? What type of regression are you carrying out? Commented Dec 2, 2021 at 5:47
• Hi, @Pitouille I am carrying out multivariable logistic regression. These two are my final predictors (I tried others and ruled them out). But now I want to make my model even better with just these 2 predictors (no more new predictors). Are those methods I proposed above valid? Hope this provides a bit more context! Commented Dec 2, 2021 at 7:26
• If you have checked that the relationship with the predictors and the outcome (logit) is linear, adding a squared term should not be relevant here. You mentioned an interaction term, have you observed any? Commented Dec 2, 2021 at 7:49
• "If you have checked that the relationship with the predictors and the outcome (logit) is linear, adding a squared term should not be relevant here." can you pls explain this part? Also, does this part apply to log transformation as well (i.e. if I observe a linear relationship, I won't need to log-transform my predictor)? Commented Dec 2, 2021 at 8:25
• In logistic regression, a relationship between the logit is assumed linear with your predictors. The response is not manipulated as is (meaning 0 and 1) but we are dealing with its log odds. To avoid duplicating content, please have a look at this simple illustration: stats.stackexchange.com/a/88607/321901 Commented Dec 2, 2021 at 8:35

Your analysis should always be guided by existing knowledge and theory. Don't blindly run many models and pick the "best" one, even if you cross-validate, because you may simply be overfitting to the test set.

In my understanding, there is a reasonable assumption that there may be an interaction between smoking and BMI, so it would make sense to include it.

The relationship between BMI and almost anything else is probably nonlinear, so it would make sense to use a spline transform of the BMI. Frank Harrell's Regression Modeling Strategies provides an excellent overview of splines. These are better than square or other polynomial transformations. Of course, you can use interactions between smoking and spline-transformed BMI.

A binary smoking variable is very crude. "Smoking" can mean two cigarettes per day, or forty. There will be a difference. If you can get an estimate of the actual number of cigarettes smoked per day, it would probably make more sense to include this numerical predictor. You can also spline-transform it. Or use an interaction with BMI (which becomes hard to interpret).

In any case, use proper to assess your model, not accuracy.

• Both are useful. To be honest, I think the difference between these two approaches is less important than making sure you avoid overfitting (which these will only guard against to a certain degree). Commented Dec 2, 2021 at 17:29
• Hm. There is no automatic effect that p values would increase if you add an interaction term. However, the main effects' coefficients are hard to interpret in the presence of an interaction. If your LR test believes the interaction makes sense, then I would go with the model with the interaction, and only interpret the interaction. Best to plot the estimated logit of the response against BMI, separately for smokers and non-smokers, that will show the effect of the interaction. Commented Dec 2, 2021 at 17:42
• Yes, exactly. It would definitely be good to look at the kind of interaction plot I suggested above. Commented Dec 3, 2021 at 8:59
• One can always simulate some data to illustrate a situation like this, did you have something like this in mind? If so, perhaps post a new question, because that would be a bit too large for a comment (feel free to link to the new question here, and I'll try to take a look). Alternatively, here is a paper I was involved in where a spline transform (of traumatic load, interacting with genotype) did improve a logistic regression model (to develop PTSD): psychiatrist.com/jcp/trauma/ptsd/… Commented Dec 7, 2021 at 18:34
• We spline transformed traumatic load before feeding the splines into the logistic model. Commented Dec 7, 2021 at 20:41

You could also create further categorical features from the numerical BMI like 'very underweight' up to 'highly overweight'. It might make it easier for your model to get improved predictions.

It might also make sense to change the algorithm. Why do you want to rule out algorithms like SVM and XG Boost before trying to tune them? These algorithms might get actually very good after tunning the parameters to your specific data set.

• Do you mean including BMI as a categorical variable (rather than a continuous variable) may improve prediction? Commented Dec 2, 2021 at 17:20
• Yes, but create meaningful categories. Maybe you split it up into 'very_low_bmi' (x<20) and 'very_high_bmi' (x>35) and 'mid_bmi' for the rest. These were just examples, I am not very familiar on how to best categorise BMI. But in general this would be the idea. Commented Dec 3, 2021 at 19:43