Skip to content
Search

Linear regression

lastmod 2024-04-26created 2015-12-2333 edits

In statistics, linear regression is a regression analysis technique that models the linear correlation between a dependent variable y and one or more independent variables (or explanatory variables) X. When based on one explanatory variable it is called simple linear regression, and when based on two or more explanatory variables it is called multiple linear regression.

Linear regression models the regression equation using a linear predictor function, and the unknown parameters are estimated from the data. A regression equation built this way is called a linear model.

Linear regression was the first regression analysis technique to be studied in depth and used widely. This is because building a model that is linear in its unknown parameters is easier than building one that is nonlinear.

Linear regression has many use cases, but they can usually be summarized into one of the following two categories.

  • If the goal is to predict values, linear regression is used to develop a predictive model that fits the data. The developed linear regression equation can then be used to predict y for x values that have no y.
  • When there is a dependent variable y and associated independent variables X1, ..., Xp, linear regression analysis can be used to quantify the relationship between Xj and y. Xj may have no relationship to y at all, or it may be a variable that provides additional information.

Linear regression models are generally built using the least square method. Linear regression models can also be built with techniques other than the least square method. A linear regression model can also be built by minimizing a loss fuction. The least square method can be applied not only to linear regression models but also to nonlinear regression models. The least square method and linear regression are closely related, but that does not make them synonyms.

Simply

Put most simply, linear regression is a concept almost the same as a trendline in Excel. That is, it infers what Linear function the dataset I currently have follows.

Linear_Regression.png

Category

Category_of_linear_regression.png

  • Univariate simple linear regression model: univariate simple linear regression model
  • Univariate multiple linear regression model: univariate multiple linear regression model
  • Multivariate simple linear regression model: multivariate simple linear regression model
  • Multivariate multiple linear regression model: multivariate multiple linear regression model

Dependent and independent variables

Cost function

A simple Cost function is as follows.

\[ W := W - \alpha\frac{1}{2m}\sum_{i=1}^{m} 2(Wx^{(i)} - y^{(i)})2x^{(i)} \] See this page for a detailed explanation of the formula.

Random linear datas

To sample random data in the form of a linear function, see the NumPy#Numpy generate data from linear function section.

sklearn APIs

DNN Regression

See also

Favorite site

References


  1. Blog.naver.com_-istech7-_linear_regression_analysis.pdf ↩

  2. Gimmesilver_-_What_is_regression.pdf ↩

  3. Linear_Regression_with_NumPy_-_Davi_Frossard.pdf ↩

author Zer0 sitemap