where Y is the first column of the input matrix and X is a matrix made of of a column of ones and remaining columns. This solution can be obtained via many numerical methods (matrix inversion, QR decomposition, Cholesky decomposition etc.), so pick your favourite!
A matrix of values. The first column is always Y[1], ..., Y[n]
, the second column is X1[1], ..., X1[n]
, the next one is X2[1], ..., X2[n]
etc. The column of ones is not given (as in real datasets), but you have to add it first in order to estimate beta0
(as in real models).
NB. In statistics, regressing on a constant is widely used. This means that the model is Y = b0 + U
, and the OLS estimate of b0
is the sample average of Y
. In this case, the input is just a matrix with one column, Y
, and it is regressed on a column of ones.