Linear regression explained

In statistics, linear regression is a statistical model which estimates the linear relationship between a scalar response and one or more explanatory variables (also known as dependent and independent variables). The case of one explanatory variable is called simple linear regression; for more than one, the process is called multiple linear regression.[1] This term is distinct from multivariate linear regression, where multiple correlated dependent variables are predicted, rather than a single scalar variable.[2] If the explanatory variables are measured with error then errors-in-variables models are required, also known as measurement error models.

In linear regression, the relationships are modeled using linear predictor functions whose unknown model parameters are estimated from the data. Such models are called linear models.[3] Most commonly, the conditional mean of the response given the values of the explanatory variables (or predictors) is assumed to be an affine function of those values; less commonly, the conditional median or some other quantile is used. Like all forms of regression analysis, linear regression focuses on the conditional probability distribution of the response given the values of the predictors, rather than on the joint probability distribution of all of these variables, which is the domain of multivariate analysis.

Linear regression was the first type of regression analysis to be studied rigorously, and to be used extensively in practical applications. This is because models which depend linearly on their unknown parameters are easier to fit than models which are non-linearly related to their parameters and because the statistical properties of the resulting estimators are easier to determine.

Linear regression has many practical uses. Most applications fall into one of the following two broad categories:

Linear regression models are often fitted using the least squares approach, but they may also be fitted in other ways, such as by minimizing the "lack of fit" in some other norm (as with least absolute deviations regression), or by minimizing a penalized version of the least squares cost function as in ridge regression (L2-norm penalty) and lasso (L1-norm penalty). Use of the Mean Squared Error (MSE) as the cost on a dataset that has many large outliers, can result in a model that fits the outliers more than the true data due to the higher importance assigned by MSE to large errors. So, cost functions that are robust to outliers should be used if the dataset has many large outliers. Conversely, the least squares approach can be used to fit models that are not linear models. Thus, although the terms "least squares" and "linear model" are closely linked, they are not synonymous.

Formulation

\{yi,xi1,\ldots,xip

n
\}
i=1
of n statistical units, a linear regression model assumes that the relationship between the dependent variable y and the vector of regressors x is linear. This relationship is modeled through a disturbance term or error variable ε — an unobserved random variable that adds "noise" to the linear relationship between the dependent variable and regressors. Thus the model takes the form y_i = \beta_ + \beta_ x_ + \cdots + \beta_ x_ + \varepsilon_i = \mathbf^\mathsf_i\boldsymbol\beta + \varepsilon_i, \qquad i = 1, \ldots, n, where T denotes the transpose, so that xiTβ is the inner product between vectors xi and β.

Often these n equations are stacked together and written in matrix notation as

y=X\boldsymbol\beta+\boldsymbol\varepsilon,

where

y=\begin{bmatrix}y1\y2\\vdots\yn\end{bmatrix},

X=\begin{bmatrix}

T
x
1
T
\x
2

\\vdots

T
\x
n

\end{bmatrix} =\begin{bmatrix}1&x11&&x1p\\ 1&x21&&x2p\\ \vdots&\vdots&\ddots&\vdots\\ 1&xn1&&xnp\end{bmatrix},

\boldsymbol\beta=\begin{bmatrix}\beta0\\beta1\\beta2\\vdots\\betap\end{bmatrix}, \boldsymbol\varepsilon=\begin{bmatrix}\varepsilon1\\varepsilon2\\vdots\\varepsilonn\end{bmatrix}.

Notation and terminology

y

is a vector of observed values

yi(i=1,\ldots,n)

of the variable called the regressand, endogenous variable, response variable, target variable, measured variable, criterion variable, or dependent variable. This variable is also sometimes known as the predicted variable, but this should not be confused with predicted values, which are denoted

\hat{y}

. The decision as to which variable in a data set is modeled as the dependent variable and which are modeled as the independent variables may be based on a presumption that the value of one of the variables is caused by, or directly influenced by the other variables. Alternatively, there may be an operational reason to model one of the variables in terms of the others, in which case there need be no presumption of causality.

X

may be seen as a matrix of row-vectors

xi

or of n-dimensional column-vectors

x

, which are known as regressors, exogenous variables, explanatory variables, covariates, input variables, predictor variables, or independent variables (not to be confused with the concept of independent random variables). The matrix

X

is sometimes called the design matrix.

xi0=1

for

i=1,\ldots,n

. The corresponding element of β is called the intercept. Many statistical inference procedures for linear models require an intercept to be present, so it is often included even if theoretical considerations suggest that its value should be zero.

\boldsymbol\beta

is a

(p+1)

-dimensional parameter vector, where

\beta0

is the intercept term (if one is included in the model—otherwise

\boldsymbol\beta

is p-dimensional). Its elements are known as effects or regression coefficients (although the latter term is sometimes reserved for the estimated effects). In simple linear regression, p=1, and the coefficient is known as regression slope. Statistical estimation and inference in linear regression focuses on β. The elements of this parameter vector are interpreted as the partial derivatives of the dependent variable with respect to the various independent variables.

\boldsymbol\varepsilon

is a vector of values

\varepsiloni

. This part of the model is called the error term, disturbance term, or sometimes noise (in contrast with the "signal" provided by the rest of the model). This variable captures all other factors which influence the dependent variable y other than the regressors x. The relationship between the error term and the regressors, for example their correlation, is a crucial consideration in formulating a linear regression model, as it will determine the appropriate estimation method.

Fitting a linear model to a given data set usually requires estimating the regression coefficients

\boldsymbol\beta

such that the error term

\boldsymbol\varepsilon=y-X\boldsymbol\beta

is minimized. For example, it is common to use the sum of squared errors
2
\|\boldsymbol\varepsilon\|
2
as a measure of

\boldsymbol\varepsilon

for minimization.

Example

Consider a situation where a small ball is being tossed up in the air and then we measure its heights of ascent hi at various moments in time ti. Physics tells us that, ignoring the drag, the relationship can be modeled as

hi=\beta1ti+\beta2

2
t
i

+\varepsiloni,

where β1 determines the initial velocity of the ball, β2 is proportional to the standard gravity, and εi is due to measurement errors. Linear regression can be used to estimate the values of β1 and β2 from the measured data. This model is non-linear in the time variable, but it is linear in the parameters β1 and β2; if we take regressors xi = (xi1, xi2)  = (ti, ti2), the model takes on the standard form

hi=

T
x
i\boldsymbol\beta

+\varepsiloni.

Assumptions

Standard linear regression models with standard estimation techniques make a number of assumptions about the predictor variables, the response variables and their relationship. Numerous extensions have been developed that allow each of these assumptions to be relaxed (i.e. reduced to a weaker form), and in some cases eliminated entirely. Generally these extensions make the estimation procedure more complex and time-consuming, and may also require more data in order to produce an equally precise model.

Notes and References

  1. Book: David A. Freedman . David A. Freedman . 2009. Statistical Models: Theory and Practice . Cambridge University Press. A simple regression equation has on the right hand side an intercept and an explanatory variable with a slope coefficient. A multiple regression e right hand side, each with its own slope coefficient . 26.
  2. .
  3. Hilary L. Seal. 1967 . The historical development of the Gauss linear model . 2333849 . Biometrika . 54 . 1/2 . 1–24 . 10.1093/biomet/54.1-2.1.