Linear Regression


In statistics, linear regression is a linear approach for modeling the relationship between a scalar dependent variable (y) and one or more independent variables (denoted X). The case of one independent variable is called simple linear regression. For more than one independent variable, the process is called multiple linear regression.

Conceptual Basis

Linear regression models assume a linear relationship between the dependent variable and the independent variable(s). This means that as the values of the input variables change, the predicted output changes at a proportional rate. This relationship is often represented as a line of best fit through a scatterplot of the observed data.

Mathematical Formulation

The general equation for a simple linear regression model is:

y = β₀ + β₁x + ε


  • y is the dependent variable
  • x is the independent variable
  • β₀ is the y-intercept (the value of y when x is 0)
  • β₁ is the slope of the line (the rate of change in y for every one-unit increase in x)
  • ε is the error term, representing unexplained variation in the data


The goal of linear regression is to find the best estimates for β₀ and β₁ using the given data points. The most common method for this is ordinary least squares (OLS) regression. OLS aims to minimize the sum of the squared differences between the observed values of the dependent variable (y) and the values predicted by the linear model.


Linear regression has wide-ranging applications in various fields, including:

  • Prediction: Forecasting future values of a dependent variable based on known values of independent variable(s).
  • Trend Analysis: Understanding trends over time in business, economics, or scientific research.
  • Causal Inference: While correlation does not imply causation, linear regression can be used to explore potential causal relationships, especially when coupled with experimental design and other techniques.
  • Hypothesis Testing: Testing hypotheses about the linear relationship between variables.


Linear regression relies on several key assumptions which should be validated for reliable results:

  • Linearity: A linear relationship exists between the dependent and independent variables
  • Independence of errors: Errors are random and uncorrelated.
  • Homoscedasticity: Constant variance of the errors across all levels of the independent variable.
  • Normality of errors: Errors are normally distributed.

Types of Linear Regression

  • Simple linear regression: A model with a single independent variable.
  • Multiple linear regression: A model with two or more independent variables.
  • Polynomial regression: A form of linear regression where the relationship between the independent variable and dependent variable is modeled as an nth degree polynomial (still considered linear due to linearity in the coefficients).

Important Notes

  • Linear regression is a powerful tool, but it's important to be mindful of its limitations and assumptions.
  • While linear regression models are relatively simple to understand, interpreting the results and applying the model appropriately requires statistical expertise.