0
$\begingroup$

I'm working with real numbers using modular arithmetic, say in the range $[0,12)$. I would like to calculate some kind of 'modular mean' over a set of values $X$ that minimizes the total error. In other words, the value $\bar{x} \in [0,12)$ such that

$\Sigma_{x \in X} \min(\bar{x}-x \mod N, x-\bar{x} \mod N)$

is minimized.

Using the ordinary mean doesn't quite work. If you consider the clock-face. Then for the values $\{1,3\}$ we get $2$ which is good. But for the values $\{10,1\}$ we get $\frac{11}{2}\mod N = 5.5$. However the value I'm looking for is $11.5$ because this gives an error of

$(11.5-10 \mod N) + (1-11.5 \mod N) = 3$

rather than $5.5$ which gives an error of $11$.

Is there a function/algorithm to find the value of $\bar{x}$? (Assuming the above makes sense!)

$\endgroup$
1
$\begingroup$

If you're minimizing the sum of the absolute values of the errors, then you can easily get degenerate solutions. For example, for the values $\{1,3\}$, yes, $2$ minimizes the total error, but so does $2.9973546$. And for the values $\{1,3.99,4.01\}$, the unique minimum is at $3.99$, when you probably want something closer to $3$.

Now, if you're willing to relax the error function, that opens the door to some better-behaved statistics. There's a particularly simple mean described here: Mean of circular quantities - Wikipedia. For further discussion on that solution and its relatives, see this topic: How to average cyclic quantities?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.