And least squares mean

One-dimensional array [x1, x2 ... xn], a required value of X, such that:

F(X) = (X-x1)2+(X-x2)2+...(X-xn)2 = min

F(X) = nX2 -  2 * (x1+x2+....+xn) + x12 + x22 + ...+xn2 = min 

Derivative of X, when dF / dX = 0, F (X) has a minimum value;

2nX - 2 (x1+x2+....+xn) = 0 

Then, X = (x1 + x2 + .... + xn) / n

Thus, in the case of one-dimensional, seeking the least squares parameter X, and averaging the same;

Using a matrix method, first create equations:

X - x1 = 0

...

X - xn = 0

That is, equations:

A n-*. 1 X-B =, equivalent to [1,1, ......] T X-= [X1, X2 ... Xn] T ;

A T AX = A T b

Similarly solve for: X = (x1 + x2 + .... + xn) / n


 

Application: in one dimension, an array [2,2,2,2,2,10] like this, to find the values ​​therein lone

First find X = Mean = 3.333

Sqrt error = [[(2-3.333) 2 + (2-3.333) 2 + (2-3.333) 2 + (2-3.333) + (2-3.333) 2 + (10-3.333) 2  ] / ( 6-1)  ] = 3.1622

If the observed value is an one-dimensional array for a distance, assuming a normal distribution N [[mu], [sigma] 2 ], it should be close to the digital U 2, but in fact is not known, when a large sample size, and usually X error instead of 

| X n- - U |> 2σ probability is as l - 95.449974%;

| X n-  - U |> 3σ of probability as l - 99.730020%;

So, based on this principle, | 10 - 3.3333 | ≈ 2σ, belongs to a small probability event, I think that 10 is a solitary value;


 

Guess you like

Origin www.cnblogs.com/pylblog/p/11359863.html