How to calculate mean value on cycle space?

86 Views Asked by At

Maybe I am not very familiar with terms, but I will try.

Imagine loop(or cycle) space, where the first element of space is the next to the last element of the same space.

The simples example is time. After 23:59 going 00:00(Or the same in PM notation).

And for me it is problem to compute mean time.

For majority of cases all is ok.

If we have 23:00 and 22:00, obviously mean time is 22:30

And what should we do in case 1:00 and 23:00, the first answer is 12:00((1+23)/2). But more obvious is 00:00. Because if I go to bed in 1:00, 2:00, 23:00, 22:00, 00:00. That is obviously not expected that next time i will go to bed at 12:00

But this is still obvious.

For me, for now, for this topic 1 problems exists: 1) How to operate with opposite values, 12:00 and 00:00, is answer should be 6:00 or 18:00??? The first obvious solution is to agree to prone to earlier time, and then 12:00 and 00:00 gives us 6:00, but 12:00 and 23:59 will give us ~17:59, and 6:00 with 17:59 is not 2 obvious mean values for almost close input values.

For me this problem have no right solution. And we should use different tequecniques to achieve some goals.

What do you think on it?

1

There are 1 best solutions below

0
On BEST ANSWER

This is a topic referred to as the mean of circular quantities. First convert the data into angles, for example if you have a number of hours $0 \leq h<24$ then the appropriate angle in radians is $$ \theta = \frac{2\pi} {24} h $$ Then from a set of angles $\theta_i$ we can compute the mean using $$ \bar{\theta} = atan2(\sum_i \sin \theta_i, \sum_i \cos \theta_i) $$ which can be understood by imagining putting points on a circle at the given angles, finding the average position of these points (which will be inside the circle), and then finding the angle to this average point. This explains one of the issues you have in your question, if the 2 points you want to average are on opposite sides of the circle, the average point will be the center of the circle, which results in an undefined angle.

Finally, convert back to the original units $$ \bar{h} = \frac{24} {2\pi} \bar{\theta} $$