I need to get average sleep interval from following data:
- 22:00-06:00
- 00:00-08:00
- 02:00-10:00
=> expected: 00:00-08:00
- 22:00-06:00
- 00:00-08:00
- 02:00-10:00
- 04:00-08:00
=> expected: 01:00-08:00
The problem is oscillation around midnight, where part is under 00:00 and part over 00:00. Simple mean 22+00+02+04 doesn't work. I could count number of times over midnight (3 in this case) and if it's more than those before midnight, I should add 25 co compensate. But this doesn't count with those people, who work at night and go sleep around 8-14!
My theory is: First, somehow I need found peak, something like the most frequented area (e.g., in 9-10 there is 5 record, in 10-11, there is 3 etc.) and then I can decide co compensate border values by adding 24 hours.
What do you think?