This is an old revision of this page, as edited by Stpasha(talk | contribs) at 21:50, 25 July 2009(→Lead: small introduction + a picture). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 21:50, 25 July 2009 by Stpasha(talk | contribs)(→Lead: small introduction + a picture)
This article needs attention from an expert in Statistics. Please add a reason or a talk parameter to this template to explain the issue with the article.WikiProject Statistics may be able to help recruit an expert.
In statistics, simple linear regression is the least squares estimator of a linear regression model with a single predictor variable. In other words, simple linear regression fits a straight line through the set of n points in such a way that makes the sum of squared residuals of the model (that is, vertical distances between the points of the data set and the fitted line) as small as possible.
Okun’s law in macroeconomics is an example of the simple linear regression. Here the dependent variable (GDP growth) is presumed to be in a linear relationship with the changes in the unemployment rate.
The adjective simple refers to the fact that this regression is one of the simplest in statistics. The fitted line has the slope equal to the correlation between y and x corrected by the ratio of standard deviations of these variables. The intercept of the fitted line is such that it passes through the center of mass (x, y) of the data points.
The parameters of the linear regression model, , can be estimated using the method of ordinary least squares. This method finds the line that minimizes the sum of the squares of errors, .
The minimization problem can be solved using calculus, producing the following formulas for the estimates of the regression parameters:
As usual,
Ordinary least squares produces the following features:
1. The line goes through the point . This is easily seen rearranging the expression as , which shows that the point verifies the fitted regression equation.
2. The sum of the residuals is equal to zero, if the model includes a constant. To see why, minimize with respect to a taking the following partial derivative:
Setting this partial derivative to zero and noting that yields as desired.
3. The linear combination of the residuals in which the coefficients are the x-values is equal to zero.
4. The estimates are unbiased.
Alternative formulas for the slope coefficient
There are alternative (and simpler) formulas for calculating :
Here, r is the correlation coefficient of X and Y, sx is the sample standard deviation of X and sy is the sample standard deviation of Y.
Inference
Under the assumption that the error term is normally distributed, the estimate of the slope coefficient has a normal distribution with mean equal to b and standard error given by:
A confidence interval for b can be created using a t-distribution with N-2 degrees of freedom:
Numerical example
Suppose we have the sample of points {(1,-1),(2,4),(6,3)}. The mean of X is 3 and the mean of Y is 2. The slope coefficient estimate is given by:
The standard error of the coefficient is 0.866. A 95% confidence interval is given by
Mathematical derivation of the least squares estimates
Assume that is a stochastic simple regression model and let be a sample of size n. Here the sample is seen as observable nonrandom variables but the calculations don't change when assuming that the sample is represented by random variables .
Let Q be the sum of squared errors:
Then taking partial derivatives with respect to and :
Setting and to zero yields
which are known as the normal equations and can be written in matrix notation as
Using Cramer's rule we get
Dividing the last expression by n:
Isolating from the first normal equation yields
which is a common formula for in terms of and the sample means.
may also be written as
using the following equalities:
The following calculation shows that is a minimum.