Sunshine Skyway Bridge from Anna Maria Island (Florida, United States), March 2014 (Photo: Anders Gustafson)
Modified 2019-07-22T11:45:21Z

If your application is used far more often during weekdays than during weekends, it is not a good idea to use a period of 30 days when gathering statistics. It is far better to use 28 days as a time span identifier.

The reason is that when using 28 days, the number of Saturdays and Sundays in the interval is always 8, which always gives a ratio of 8/28 = 2/7 ≈ 0.29. When using 30 days this number will instead vary between 8, 9 and 10, depending on the starting day, which gives a ratio in the interval 8/30 = 4/15 = 0.26 to 10/30 = 1/3 ≈ 0.33.

Note: Yes, there are holidays that will ruin the perfect measurements, but using 28 days during the year will often make much more reliable figures than using 30 days.

Number of weekend days (Saturdays and Sundays) for 28 vs 30 consecutive days:

    Starting at Monday:    8 vs 8
    Starting at Tuesday:   8 vs 8
    Starting at Wednesday: 8 vs 8
    Starting at Thursday:  8 vs 8
    Starting at Friday:    8 vs 9
    Starting at Saturday:  8 vs 10
    Starting at Sunday:    8 vs 9

For the same reason there is neither a good idea to use a period of 10 days. If you want useful statistics, you need to use periods that are multiples of seven days.

Let us look at some examples.

Assume that weekdays have 1000 hits per day, weekends have 200 hits per day. A total of 5400 per week. This always gives 21600 hits per 28 days, no matter which consecutive 28 days you choose. But for 30 days this value will instead fluctuate between 20 * 1000 + 10 * 200 = 22000 and 22 * 1000 + 8 * 200 = 23600. The difference between these values is more than seven percent, which you have to take into consideration.

If there should be even more difference between weekdays and weekends the fluctuation is of course larger. 1000 hits on per day on weekdays and 5 hits per day on weekends, gives 20 * 1000 + 8 * 5 = 20040 for 28 days. For 30 days it gives 20 * 1000 + 10 * 5 = 20050 to 22 * 1000 + 8 * 5 = 22040, which is almost ten percent.
So if you measure the "velocity" for the last 28 days you will normally see the value 20040. If this value increases to 21000, you most certainly has an actual increase. But if using 30 days, you must consider starting and ending days in your interval, before jumping to conclusions.

If you have another time unit than days, you may of course have the same troubles. For example, it is probably better to have a 24-hour interval than a 12-hour interval.

Using months may also trick you, as they do not consist of the same number of days.

Even if you compare the same month from year to year, you must thoroughly evaluate the figures. The "normal" February is no problem since it has 28 days, but the other months have 30 or 31 days. So the same problems with ratio for weekdays/weekends as discussed above applies.

First published by Anders Gustafson 2019-07-22
Logo for NNM
NNM Logo
Friends in need
CCF Cheetah Conservation Fund
NNM Clock
Random quote
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction.
Albert Einstein