# Statistics - Finding standard deviation of an angle

Tags:
1. Nov 11, 2015

### 9988776655

1. The problem statement, all variables and given/known data
Find the formula for the standard deviation (s_h) of heading angle, given the north and east standard deviation of position of two points (s_n1, s_e2, s_n2, s_e2), each point's north-east covariance (s_cov_ne_1, s_cov_ne_2) and the north and east distance between them (d_n, d_e). Simplify the problem by assuming that point 1 is known and therefore has zero standard deviation. Heading is defined as the angle from north from position 1 to position 2.

2. Relevant equations
heading = atan2 (-d_e / -d_n) ← this is given in the question. (atan2 not atan squared)
https://en.wikipedia.org/wiki/Propagation_of_uncertainty

3. The attempt at a solution
The east distance standard deviation is:
s_e = sqrt ( s_e1^2 + s_e2^2 – 2*cov); (not sure what covariance should be)

The north distance standard deviation is:
s_n = sqrt ( s_n1^2 + s_n2^2 – 2*cov); (not sure what covariance should be)

The standard deviation of (-d_e / -d_n) is:
s_x = sqrt ( (-d_e / -d_n)^2 * ( (s_e/d_e)^2 + (s_n/d_n)^2 – 2*cov/(d_n*d_e) ) )
(not sure what covariance should be)

Dont know how to get the covariance of atan2(something)

Last edited: Nov 11, 2015
2. Nov 11, 2015

### SteamKing

Staff Emeritus
atan2 (y, x) is a variant of the regular arctan function, which permits determination of the angle in all four quadrants, based on the signs of x and y individually:

https://en.wikipedia.org/wiki/Atan2

3. Nov 12, 2015

### BvU

Differentiate that according to the definition of covariance and let the error propagate as usual , foundation under all this is the Taylor expansion.

Last edited by a moderator: May 7, 2017
4. Nov 12, 2015

### 9988776655

According to Wikipedia it is required to use partial derivatives to differentiate atan2(y/x):
d(atan2(y/x)) = -y / (x^2 + y^2) dx + x / (x^2+y^2) dy
The rules for propagation are here: https://en.wikipedia.org/wiki/Propagation_of_uncertainty
I can use the rules to propagate something^2 and something / something but how do I propagate dx or dy? There does not appear to be any rules for this.

Last edited by a moderator: May 7, 2017
5. Nov 12, 2015

### BvU

dx and dy are the uncertainties themselves !
if the error in x is dx then the error in f(x) is ${\delta f\over \delta x} \, dx$ (a.k.a. $f'\, dx$ or $f_x dx$)

analogous with two variables: f = f(x,y) $\rightarrow\ df = f_x dx + f_y dy\ \rightarrow df^2 = f_x^2 dx^2 + f_y^2 dy^2 + 2 f_x f_y dx dy$
If x and y are uncorrelated, this last term drops out (expectation value = 0), but when the covariance is $\ne$ 0 it stays in.

--

You should now see from the above that the covariance is the expectation value of $dx\,dy$.

If your exercise mentions covariance, i should expect your textbook or lecture notes have something to say on that !

Last edited: Nov 12, 2015
6. Nov 12, 2015

### 9988776655

If I understand this correctly, because in my example x = -d_n (the distance in the north direction between two points) then
dx = -1
We had d(atan2(y/x)) = -y / (x^2 + y^2) dx + x / (x^2+y^2) dy
To get the variance, would I just ignore dx and dy in this calculation?

how to I combine the rules for to get -y/(x^2 + y^2) dx ?

7. Nov 13, 2015

### BvU

Sorry for the casual (but somewhat overlapping) notation. I'll make it worse with a qualitative story later on. Have to work first ...

8. Nov 13, 2015

### BvU

If you are given $\ x\pm \Delta x\$ and $\ y\pm\Delta y \$ and $\ f(x,y) \$then $$\left (\Delta f \right )^2 = \left (\partial f \over \partial x\right )^2 (\Delta x)^2 + \left (\partial f \over \partial y\right )^2 (\Delta y)^2 + 2\, \left (\partial f \over \partial x\right )\left (\partial f \over \partial y\right ) (\Delta x)(\Delta y)$$ The $dx$ and $dy$ in post #4 and #5, the $\Delta x$ and $\Delta y$ in this post: they are your se and sn : the variations in the stochastic variables $x$ and $y$, your de and dn. $(\Delta x)(\Delta y)$ is the covariance ${\rm cov}_{xy}$.

Last edited: Nov 13, 2015
9. Nov 13, 2015

### 9988776655

As per the first post:
$$s_e = \sqrt{s_{e1}^2 + s_{e2}^2 – 2*cov_{e1e2}}\\s_n = \sqrt{s_{n1}^2 + s_{n2}^2 – 2*cov_{n1n2}}$$

Where:
$$s_{n1}$$ = North standard deviation of position of point 1
$$s_{n2}$$ = North standard deviation of position of point 2
$$s_{e1}$$ = East standard deviation of position of point 1
$$s_{e2}$$ = East standard deviation of position of point 2
$$s_n$$ = Standard deviation of North distance between each point
$$s_e$$ = Standard deviation of East distance between each point

Using BvU's forumula:
$$Let\\x = d_e\\y=d_n\\\triangle x \triangle y=cov_{xy}\\\triangle x=s_e\\\triangle y=s_n \\f=atan2(\frac{-d_e}{-d_n})\\\frac{\partial f}{\partial d_e} = \frac{d_n}{d_e^2 + d_n^2}\\\frac{\partial f}{\partial d_n} = \frac{-d_e}{d_e^2 + d_n^2}$$

Then:
$$(\triangle f)^2=(\frac{d_n}{d_e^2 + d_n^2})^2(s_e)^2+(\frac{-d_e}{d_e^2 + d_n^2})^2(s_n)^2+2(\frac{d_n}{d_e^2 + d_n^2})(\frac{-d_e}{d_e^2 + d_n^2})(cov_{d_ed_n})$$

If one point is assumed perfectly known as given by the question, are$$cov_{d_ed_n}$$ and $$cov_{n1n2}$$ and $$cov_{e1e2}$$ zero?

Usually, uncertainties are reported as x +- y. (+- means plus or minus). Is y the standard deviation as given in my example? Does the same formula apply to any measurement of uncertainty?

Last edited: Nov 14, 2015
10. Nov 14, 2015

### BvU

Yes. I wrote $\ x\pm\Delta x\$; however, here there are more results and the uncertainties are not independent.

I would say $\ s_{n1} = 0\ \ \& \ \ s_{e1} = 0\$, as well as $\ s\_{\rm cov}_{ne1} = 0 \$.

My perception is that the complicated situation is simplified as follows:

where the pink ellipse indicates that the covariance is > 0.

I don't see a $cov_{e1e2}$, a $cov_{n1n2}$ or a $cov_{d_ed_n}$ in the first post, only a $\ s\_{\rm cov}_{ne1} \$ (which is assumed to be zero) and a $\ s\_{\rm cov}_{ne2} \$.

The simplification lets $\ \ s_e = s_{e2}\ \$ and $\ \ s_n = s_{n2}\ \$ be the uncertainties in $\ d_e\$ and $\ d_n\$ and $\ s\_{\rm cov}_{ne2} \$ the covariance of these uncertainties. Still, the big "Then $(\triangle f)^2=...$" expression is correct (when you substitute the given $\ s\_{\rm cov}_{ne2} \$ for $\ cov_{d_ed_n}\$ )

-- and that $\ s\_{\rm cov}_{ne2} \$ is not zero !​

--