Saturday, June 13, 2015

Regression using Apache Math API

Simple Linear Regression

In simple linear regression, a dependent variable y is predicted from one predictor variable x.

y = intercept + slope * x 

also written as  y = b * x + A

x - the independent variables which form the design matrix
y - the dependent or response variable

Multiple Linear Regression

In multiple regression, the dependent variable is predicted by two or more variables.

Equation with 2 predictor variables is y = b1 * x1 + b2 * x2 + A

The values of b (b1 and b2) are sometimes called “regression coefficients” and
sometimes called “regression weights.”


Y=X*b+u
where Y is an n-vector regressand, X is a [n,k] matrix whose k columns are called regressors, b is k-vector of regression parameters and u is an n-vector of error terms or residuals.

Here X[n,k] denotes k number of independent variables and n number of observations (rows).
Y is a [n,1] matrix/array

Linearity of a problem can be confirmed if the coefficient of determination (R2) is large i.e. R2 = 1 indicates that the fitted model explains all variability in y, while R2 = 0 indicates no 'linear' relationship.

No comments:

Post a Comment