How Does Least Squares Determine the Mean and Variance?

  • Thread starter Thread starter zollen
  • Start date Start date
  • Tags Tags
    Square
Click For Summary
The discussion focuses on using least squares to determine the mean and variance of a set of values projected onto a constant line. It establishes that the mean of the values, represented as ##\hat{x}##, is calculated by averaging the components of vector b, leading to the expression ##\hat{x} = b_{avg}##. The error vector e is derived from the difference between b and the projection of ##\hat{x}##, with its variance and standard deviation defined in terms of the components of e. The projection matrix P is discussed, highlighting that it is a rank one matrix and not invertible, with the correct formulation being proportional to ##\mathbf{aa}^T##. The conversation emphasizes the importance of recognizing scalar versus matrix operations in the context of projection calculations.
zollen
Messages
3
Reaction score
0
This problem projects b = (b1,b2...,bm) onto the line through a = (1, 1, 1, ...1). We solve m equations ax = b in 1 unknown (by least squares).

(a) Solve aT a ##\hat{x}## = aT b to show that ##\hat{x}## is the mean (the average) of the b’s.
(b) Find e = b - a ##\hat{x}## and the variance ||e||2 and the standard deviation ||e||
(c) The horizontal line ##\hat{x}## = 3 is closest to b = (1, 2, 6). Check that p = (3, 3 3) is perpendicular to e and find the 3 by 3 projection matrix P.

Ans(a): Because a = (1,1,1,...1), therefore aT a = 1 + 1 + 1 +...+ 1 = 1 * m = m
And aT b = b1 + b2 + ... + bm
So ##\hat{x}## = (b1 + b2 + b3 + ... + bm) / m = bavg

Ans(b): Need help..

Ans(c): Need help..
 
Last edited by a moderator:
Physics news on Phys.org
Ans(b):
Given ##\hat{x}## = bavg (from Ans(a))
Therefore
e = b - a \hat{x} =<br /> \begin{bmatrix}<br /> b_1\\<br /> b_2\\<br /> ..\\<br /> b_m<br /> \end{bmatrix}<br /> ~-~<br /> \begin{bmatrix}<br /> 1\\<br /> 1\\<br /> ..\\<br /> 1<br /> \end{bmatrix}<br /> ~b_{avg}<br /> =<br /> \begin{bmatrix}<br /> e_1\\<br /> e_2\\<br /> ..\\<br /> e_m<br /> \end{bmatrix}<br />

||e||^2~=~\frac{{e_1}^2 + {e_2}^2 + ... + {e_m}^2}{m}
||e||~=~\sqrt{ \frac{{e_1}^2 + {e_2}^2 + ... + {e_m}^2}{m} }

Ans(c): p=Pb~~and~~P= \frac{a * a^t}{a^t * a}
a = \begin{bmatrix}<br /> 1\\<br /> 1\\<br /> 1<br /> \end{bmatrix}
But...
a^t * a<br /> ~=~<br /> \begin{bmatrix}<br /> 1&amp;1&amp;1\\<br /> 1&amp;1&amp;1\\<br /> 1&amp;1&amp;1<br /> \end{bmatrix} has no inverse...

Would anyone show me how to calculate the projection matrix?
 
Last edited by a moderator:
zollen said:
Ans(c): p=Pb~~and~~P= \frac{a * a^t}{a^t * a}
a = \begin{bmatrix}<br /> 1\\<br /> 1\\<br /> 1<br /> \end{bmatrix}
But...
a^t * a<br /> ~=~<br /> \begin{bmatrix}<br /> 1&amp;1&amp;1\\<br /> 1&amp;1&amp;1\\<br /> 1&amp;1&amp;1<br /> \end{bmatrix} has no inverse...

Would anyone show me how to calculate the projection matrix?
I'm not sure what you're trying to do here.

## \mathbf {aa}^T## is a rank one matrix with trace of 3.

## \mathbf {a}^T \mathbf a = 3## i.e. it is a scalar.

of course by cyclic property of trace and the fact that the trace of a scalar is that scalar, we have##\mathbf {a}^T \mathbf a =trace\big(\mathbf {a}^T \mathbf a\big) = trace\big(\mathbf {aa}^T\big) = 3##

Projectors (that aren't the identity) are always not invertible. Your projector is simply ##\propto \mathbf {aa}^T## i.e. you re-normalize its sole non-zero eigenvalue to be one. Then as usual, the trace operation gives you the rank of your projector.

A couple of concerns:

I'm not sure why you introduced a ##*## operation, or why you divide by "##\mathbf {a}^T \mathbf a##" in your projector formula without recognizing that it is a scalar -- in general 'dividing by a matrix' doesn't make any sense except for the very special case when it is in fact a non zero scalar that we're talking about. (Hadamard products are excluded from this writeup.)
 
Thread 'How to define a vector field?'
Hello! In one book I saw that function ##V## of 3 variables ##V_x, V_y, V_z## (vector field in 3D) can be decomposed in a Taylor series without higher-order terms (partial derivative of second power and higher) at point ##(0,0,0)## such way: I think so: higher-order terms can be neglected because partial derivative of second power and higher are equal to 0. Is this true? And how to define vector field correctly for this case? (In the book I found nothing and my attempt was wrong...

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 3 ·
Replies
3
Views
860
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
2K
  • · Replies 35 ·
2
Replies
35
Views
6K