3
$\begingroup$

I have 3 numbers that physically must add up to zero. Unfortunately, each is obtained from a noisy measurement and they don't add up exactly. Assuming the noise is Gaussian and given 3 corresponding standard deviations (one for each number), what is the correct way to change the numbers so that they add up correctly? It seems like the number with the smallest stdev should be moved least, etc...

It feels like a least squares problem, and I think I can do this with an optimizer like Nelder Mead or something, but a closed form solution would be very welcome.

  • 0
    I wasn't aware of that usage of the word. I withdraw my objection (although I think maybe a title like "Adjusting noisy measurements so they sum to zero" might make it easier for future generations to find this page). As for choice of site, my thought was that if you didn't get a useful answer here, you might try there - but it seems to have worked for you here, so, never mind.2012-09-05

2 Answers 2

1

The correct way to change the numbers, from the maximum likelihood perspective, is to use $ b_1^\prime = \frac { a_1 b_1 ( a_2 + a_3 ) - a_2 a_3 ( b_2 + b_3 ) } { a_1 a_2 + a_2 a_3 + a_3 a_1 } $ and similarly for $b_2$ and $b_3$ where $b_i$ is the $i$th data point and $a_i$ is $1 / \sigma_i^2$ where $\sigma_i$ is $i$th standard deviation. Wolfram alpha was used to get this closed form solution of the constrained least squares problem.

  • 0
    The edit history has more details, but I didn't do anything more interesting than type the log likelihood and the constraint into wolfram alpha.2012-09-05
2

X$_1$=a$_1$+e$_1$,X$_2$=a$_2$+e$_2$, and X$_3$=a$_3$+e$_3$ where a$_1$+a$_2$+a$_3$=0.

e$_1$ has mean 0 and variance σ$_1$^2$ e$_2$ has mean 0 and variance σ$_2$^2$ e$_3$ has mean 0 and variance σ$_3^2$

X$_1$+X$_2$+X$_3$=a$_1$+a$_2$+a$_3$+e$_1$+e$_2$+e$_3$=0+e$_1$+e$_2$+e$_3$ is Gaussian

E(X$_1$+X$_2$+X$_3$)=0 Var(X$_1$+X$_2$+X$_3$)=σ$_1^2$+σ$_2$^2$+σ$_3$^2$

If you are given that X$_1$+X$_2$+X$_3$ =a ≠ 0, Set Z=X$_1$+X$_2$+X$_3$-a. Then Z=0.

E(a)=0 and Var(a)=σ$_1$^2$+σ$_2$^2$+σ$_3^2$ and a is Gaussian. So the question is how to split a into three parts s$_1$, s$_2$, s$_3$ such that s$_1$+s$_2$+s$_3$=a where s$_i$ is the amount X$_i$ is adjusted. Assume you want to

minimize E[(X$_1$-s$_1$)$^2$+(X$_2$-s$_2$)$^2$+(X$_3$-s$_3$)$^2$] where s$_1$+s$_2$+s$_3$=a. The question is how to choose s$_1$, s$_2$ and s$_3$ given a.

E[(X$_1$-s$_1$)$^2$+(X$_2$-s$_2$)$^2$+(X$_3$-s$_3$)$^2$] =

EX$_1^2$+E[s$_1$^2$] + EX$_2$^2$+E[s$_2$^2$]+EX$_3$^2$+E[s$_3^2$]=

E[s$_1^2$] +E[s$_2$^2$]+E[s$_3$^2$]=s$_1$^2$+s$_1$^2$+s$_3^2$.

Since s$_1$=a-s$_2$-s$_3$, s$_1^2$+s$_1$^2$+s$_3$^2$=(a-s$_2$-s$_3$)$^2$+s$_2$^2$+s$_3$^2$

  • 0
    Thank you for your reply. I like the way you're thinking about it, but I don't see how to get the answer I'm looking for from your last line. I wish I could combine your rigor with binn's solution below which seems to give the right answers.2012-09-05