linear regression Algorithm

If the goal is to explain variation in the response variable that can be ascribed to variation in the explanatory variables, linear regression analysis can be apply to quantify the strength of the relationship between the response and the explanatory variables, and in particular to determine whether some explanatory variables may have no linear relationship with the response at all, or to identify which subsets of explanatory variables may contain redundant information about the response. 

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. Least squares linear regression, as a means of finding a good rough linear fit to a set of points was performed by Legendre (1805) and gauss (1809) for the prediction of planetary movement. Quetelet was responsible for make the procedure well-known and for use it extensively in the social sciences.

linear regression source code, pseudocode and analysis