NMath User's Guide

TOC | Previous | Next | Index

Chapter 42. Linear Regression (.NET, C#, CSharp, VB, Visual Basic, F#)

Class LinearRegression computes a multiple linear regression from an input matrix of independent variable values (the predictor matrix or regression matrix) and a vector of dependent variable values (the observation vector).

In a linear model, a quantity y depends on one or more independent variables a1, a2,...,an such that y = x0 + x1a1 + ... + xnan. (Parameter x0 is called the intercept parameter.) Several observations of the independent values ai are recorded, along with the corresponding values of the dependent variable y. If m observations are performed, and for the ith observation we denote the values of the independent variables ai1, ai2,...,ain and the corresponding dependent value of y as yi, then we form the linear system Ax = y, where matrix A = (aij) and vector y = (yi). The regression solution is the value of x that minimizes ||Ax - y||.

This chapter describes how to use the LinearRegression class, and related supporting classes.