Check Simple linear regression for basics.

Formulation is as follows

where is the number of regressors.

Let and . Then we need equations.

Now follow:

Then we replace with vector, combining all the equations

then

is our multiple linear model.

here is

and LSE is

Here is Best Linear Unbiased Estimator for .

And sums of square are

R

In R use

  1. solve(A) to find .
  2. t(A) for
  3. lm(y~x1+x2+...xn) for multiple linear regression