June 23, 2020

MULTIPLE LINEAR REGRESSION

  1. Linear regression is useful when we want to predict the values of a variable from its relationship with other variables.

  2. There are two different types of linear regression models:

    1. Simple Linear Regression

    2. Multiple Linear Regression

  3. Multiple Linear Regression uses two or more independent variables to predict the values of the dependent variable.

  4. Residual Analysis is the difference between the actual value y, and the predicted value y^ is the residual e.

    1. e = y - y^

  5. Sklearn’s linear_model.LinearRegression comes with a .score( ) method that returns the coefficient of determination R squared of the prediction.

    1. 1 - u/v

    2. Where u is the residual sum of squares:

      1. ((y - y.predict()) ** 2).sum( )

    3. And y is the total sum of squares:

      1. ((y - y.mean())** 2).sum( )

    4. The TSS tells you how much variation there is in the y variable.

    5. R squared is the percentage variation in y explained by all the x variables together.

    6. The best possible R squared is 1.00, but usually a R squared of 0.70 is considered good.

Previous
Previous

July 30, 2020

Next
Next

July 20, 2019