Use Multiple linear regression in python when you have more than three measurement variables and one of the measurement variables is the dependent (Y) variable.
The rest of the variables are independent (X) variables you think they may have an effect on the dependent variable.
The purpose of a multiple regression is to find an equation that predicts the Y variable as a linear function of the X variables.
Assumption of Regression Model :-
You have to find an equation that gives a linear relationship between the X variables and the Y variable as
Ŷ=a+b1X1+b2X2+b3X3...
The Ŷ is the expected value of Y for a given set of X values.
b1 is the estimated slope of a regression of Y on X1.
If all of the other X variables could be kept constant, and so on for b2, b3, etc.
Not going to explain the math involved but multiple regressions finds values of b1, etc.
This can range from 0 (for no relationship between Y and the X variables) to 1 (for a perfect fit, no difference between the observed and expected Y values).
The P value is a function of the R2, the number of observations, and the number of X variables.
When the purpose of multiple regressions is prediction the important result is an equation containing partial regression coefficients.
If you had the partial regression coefficient and measured the X variables you could plug them into the equation and predict the corresponding value of Y.
The magnitude of the partial regression coefficient depends on the unit used for each variable so it does not tell you anything about the relative importance of each variable.
When the purpose of multiple regressions understand functional relationships the important result is an equation containing standard partial regression coefficient like this-
Y'̂=a+b'1x'1+b'2x'2+b'3x'3...
Where b'1 is the standard partial regression coefficient of Y on X1.
It is the number of standard deviations that Y would change for every one standard deviation change in X1 if all the other X variables could be kept constant.
The magnitude of the standard partial regression coefficients tells you something about the relative importance of different variables X variables with bigger standard partial regression coefficients have a stronger relationship with the Y variable.
Output:-