matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.85k stars 2.64k forks source link

Moving average in graphs for trend identification #1718

Closed anonymous-matomo-user closed 13 years ago

anonymous-matomo-user commented 14 years ago

Hi, I'd like to see a simple moving average line in some graphs, mainly visitors.

Rationale: On daily graphs, peaks are not uncommon. Those make it hard to see if the overall trend goes up or down.

Enter The Moving Average Indicator.

I suggest a 5-day moving average, this would result in 6 more data points that will have to be rendered in the default 30-day-view.

Thanks for your consideration! Keywords: wishlist

robocoder commented 14 years ago

A 5-day moving average means that each day we also compute the average over the last 5 days. On a 30 day view, that's 26 or 30 data points, depending on the implementation.

Where period != day, the moving average is less useful because aggregation also has a smoothing effect on data.

Such a feature would be nicer if OFC had the ability to smooth a line via bezier curves / cubic splines.

anonymous-matomo-user commented 14 years ago

Replying to vipsoft:

A 5-day moving average means that each day we also compute the average over the last 5 days.

You're right, my bad. Thanks for checking the numbers.

Where period != day, the moving average is less useful because aggregation also has a smoothing effect on data.

Exactly!

Such a feature would be nicer if OFC had the ability to smooth a line via bezier curves / cubic splines.

Oooh, that would be cool!

anonymous-matomo-user commented 14 years ago

Here's another wrinkle. I have several sites where the weekday usage is several times the weekend usage. A straight 5-day moving average, which would be a great idea for many sites, would be misleading in this case. It would fit my use case here much better if it was possible to exclude certain days from the 5-day average - i.e. use the last 5 weekdays and just skip over the weekends. Or better yet, have one moving average for just the weekdays and another for just the weekends.

anonymous-matomo-user commented 14 years ago

I don't think excluding specific days is the right way to go here. After all, I am suggesting a SMA to flatten peaks and see a smooth trend over time, without re-introducing separate data points.

anonymous-matomo-user commented 14 years ago

The complication in my case is that I basically have two smooth trends over time: the weekday trend and the weekend trend. This might be out of scope; if so, I can just not use the moving average feature for these sites.

Actually, the other moving average that would be useful would be to see both the most recent, say, Tuesday's number, and the moving average of the past 5 Tuesdays. Just food for thought.

mattab commented 13 years ago

I don't think we will implement this in core, but if a patch comes in we will definitely consider.