What is linear regression?

Linear regression is used to predict the relationship between two variables or factors. One variable (independent variable) is used to predict the value for another variable (dependent variable).

Regression is a method of modeling a target value based on independent predictors.

Linear Regression is a supervised machine learning algorithm. It predicts the value within a continuous range of numbers.

1. Simple regression

Simple linear regression uses traditional slope-intercept form to produce the most accurate predictions. x represents our input data and y represents our prediction.

The motive of the linear regression algorithm is to find the best values for m and c in the equation y = mx + c.

Graph for a line following the equation y=mx+c.

2. Multiple linear regression

Multiple linear regression has one dependent variable and two or more independent variables.

Assumptions in linear regression

There are a few assumptions we make when using linear regression:

  • The relationship between the dependent and independent variables should be almost linear.
  • The data is homoscedasticThe variance between the results should not be too much.
  • The results obtained from observation should not be influenced by the results obtained from the previous observation.
  • The residuals should be normally distributed. This assumption means that the probability density function of the residual values is normally distributed at each independent value.

Uses of linear regression

Linear regression can be used for:

  • determining the strength of predictors
  • forecasting an effect
  • trend forecasting