Improving the mean squared error of the ordinary least squares solution

554 Views Asked by At

I have the following relationship that holds:

$y = a x_1 + b x_2$

Now I would like to determine constants $a$ and $b$ by performing tests.

Each test results in 10 values for $y$, $x_1$ and $x_2$. So I get the following set of equations:

$\underbrace{\begin{bmatrix} y_1\\ y_2\\ \vdots \\ y_{10} \end{bmatrix}}_{Y} = \underbrace{\begin{bmatrix} x_{1,1} & x_{2,1} \\ x_{1,2} & x_{2,2} \\ \vdots & \vdots \\ x_{1,10} & x_{2,10} \end{bmatrix}}_{X}\underbrace{\begin{bmatrix} a\\ b \end{bmatrix}}_A$

Now I use Matlab's lscov to obtain an ordinary least squares estimate for $a$ and $b$.

Some measurement sets provide really good results, while others don't. Now I would like to find out why this is the case, and what I can do to improve results.

When the results are good, the mean squared error which Matlab provides by using lscov is low. When the results are not good, the $mse$ is relatively high.

The mean squared error is given by :

$mse = Y'(I-X(X'X)X')Y$

Now I can change the input (which is closely related to the variable $y$) to my system to obtain different kind of measurements.

Now I wonder, can I simplify the equation for the $mse$ to find out how I can decrease the value for the $mse$, because now I don't directly see the consequences of a changing $Y$ and $X$ matrix.

1

There are 1 best solutions below

0
On

First off, your formula should be: $$mse = \frac 1{N-1}Y^T(I - X(X^TX)^{-1}X^T)Y$$

That is, with $(X^TX)^{-1}$ and divided by the number of measurements N minus 1, which is 9 in your case.

This formula always works to find the optimal solution.

The typical reason why it can give a bad result, is if your input gives no clue about the relation. For instance because all input is clustered at 1 point. The data needs to be spread around a bit.