# What does Multiple Linear Regression teach us about losing weight?

*This is a Math post, not a Nutrition post!*

*We suggest that before any change in your routine to lose/gain weight, look for a specialist.*

A few years ago I needed to learn about Multiple Linear Regression to help a master’s student in Engineering. It was an interesting and reasonably effective learning experience to address the problem he was researching (Sewage Treatment Plants). However, there is more to this method than the calculations and values that allow us to estimate linear models for the behavior of unknown functions from their observable data. I say there is an application of great interest to most of us who are concerned about getting overweight.

For starters, let’s see exactly what Multiple Linear Regression does (in a very succinct and generic way).

We have a record of measurements of various events/equipment/actions… and we suppose that there is a mathematical function that is linear and that explains from this set of “variables” that we measure, the output of the system. So, for each variable that we recorded, we were able to stipulate how much it actually influences the output of the system (Calm down, maybe the conversation is a little complicated so far, but if you’ve made it this far, congratulations! from now).

We will give our system a name, it will be called “weight gain”. Our intention, for example, may be that this output is close to zero (ie, we keep our weight as is).

So, we started to list a series of 26 actions within our routine that we believe influence the “weight gain” system (I will creatively call them the 26 letters of the alphabet).

**a, b, c, d, e, …, x, y, z.**

If this action-dependent system can be roughly expressed as a linear model, then, for each action, there must be an influence factor represented by a real number αi, where i is a natural number between 1 and 26, like this:

α₁a + α₂b + α₃c + α₄d + α₅e + … + α₂₄x + α₂₅y + α₂₆z + ERROR = weight gain

This “ERROR” represents the very imprecision of the model. So, if the ERROR is 0, it means that we have actually found a linear model that explains our system. Although in the simplest exercises this occurs, in practice (or in the most fun exercises) the ERROR will always be different from 0, no matter how precise the model is and how much the system adapts to it. In case the ERROR is very large, this is an indication that the model in question is not good, and perhaps other variables should be included.

If we have the measurements of these 26 variables at hand (for example, variable a, “how many times a month do we eat chocolate”, variable b, “how many minutes a week do we practice moderate physical activity”, …) and we know how the “weight gain” varies ”, we were able to determine (if there is a linear model) what the values of α₁, α₂, α₃, α₄, α₅, … ,α₂₄, α₂₅, α₂₆ would be. So:

- if any αi is close to 0, its action seems to have little influence on weight gain or loss;
- if any αi is less than 0, its action seems to lead to weight loss;
- if any αi is greater than 0, its action seems to lead to weight gain;

Okay, you might be thinking that you already understand everything, that it’s just reducing the αi greater than 0, right? Wrong! This would be a mere instrumentalization of Mathematics and the plan could very well backfire.

The first step in this case is to check if the data makes any sense for your routine. For example, I rarely eat chocolate and almost every day I am cycling, but if the data collected is for example between Christmas and New Years, I will probably not be cycling on these dates and I will eat a lot more chocolate than I usually do. how.

This means that observing the situation in which the measurements were collected is strictly necessary to understand the influence of variables on the system. If the data were collected, for example, in a specific period of rain when I am not riding a bicycle, this does not represent the routine, but an atypical context that should not be considered. In summary, atypical periods (travels, holidays, parties, or even while we are recovering from some illness or injury) should not be considered in these models, they are cases that are outside the rule and trying to make them rules would not represent the system in its majority.

Okay, not considering the exception dates, we can just take/reduce everything that has an αi greater than 0, right? Wrong! Because we need to consider that there are related variables, that is, when we remove/reduce the variable “a”, we may not have the following system:

α₂b + α₃c + α₄d + α₅e + … + α₂₄x + α₂₅y + α₂₆z + ERROR = weight gain

Instead, have the system:

β₂b + β₃c + β₄d + β₅e + … + β₂₄x + β₂₅y + β₂₆z + ERROR = weight gain

Where β is a real number.

This means that when we force the modification of a variable, the influence that each of the others exerts on the system can change. For example, cutting out my daily cup of chocolate milk from my routine, which reduced my willingness to ride a bike, also made me increase the amount of food at meals and the frequency with which I consume chocolate. That is, removing this variable that had an αi greater than 0 provided an increase in other αi so that the system output also increased.

But this can only be noticed if, after changing one of the variables, we keep observing how the system is behaving. In this case, after a few weeks without the chocolate, I noticed that the weight gain increased and I understood what was causing this change. So, I thought it was good to resume the chocolate milk in my routine.

If realizing this with changing one variable already seemed a bit complex, who would have thought if we changed several at once. We wouldn’t really have a clear understanding of what might be influencing the system. Hence the importance of this adjustment process being slow and with constant monitoring.

I hope you enjoyed this discussion as I enjoyed learning about Multiple Linear Regression 🙂

*Finally, I reiterate that this is a post on Mathematics and not on Nutrition!*

*We suggest that before any change in your routine to lose/gain weight, look for a specialist.*