dygraphs icon indicating copy to clipboard operation
dygraphs copied to clipboard

x-ranged rolling average

Open mirabilos opened this issue 2 years ago • 2 comments

The current rolling average uses a fixed number of data points.

Would it be feasible to add a different mode in which it averages over a settable Δx (for use with nōn-equidistributed data, like real-life network packet traces, where you can have nothing for short time, then bursts)?

Does anyone have any idea whether this is feasible and as to the math behind this? (My school never offered statistics.)

mirabilos avatar Jan 18 '23 06:01 mirabilos

Yes, it's a good idea. The obvious use case that springs to mind is showing a weekly average. You can probably do this already using a DataHandler (see #249, particularly the linked doc).

One thing to watch out for: if your data is irregular (say mostly on weekdays with gaps on weekends) then that irregularity will still show up after rolling (since you'll wind up with all the same x-values). It may be preferable to calculate weekly averages on your own as a pre-processing step.

danvk avatar Jan 18 '23 14:01 danvk

On Wed, 18 Jan 2023, Dan Vanderkam wrote:

Yes, it's a good idea. The obvious use case that springs to mind is showing a weekly average. […] One thing to watch out for: if your data is irregular (say mostly on weekdays with gaps on weekends) then that irregularity will still show

My use case here is a bit different. In your example, it would be more like averaging over hours or 4/6-hour periods, avoiding pulling values from Friday and Monday into the sparse weekend days. I could have hundreds of values on a workday and perhaps one or so during weekends.

Does this make sense?

Thanks, //mirabilos

Infrastrukturexperte • tarent solutions GmbH Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/ Telephon +49 228 54881-393 • Fax: +49 228 54881-235 HRB AG Bonn 5168 • USt-ID (VAT): DE122264941 Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

                    ****************************************************

/⁀\ The UTF-8 Ribbon ╲ ╱ Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:  ╳  HTML eMail! Also, https://www.tarent.de/newsletter ╱ ╲ header encryption! ****************************************************

mirabilos avatar Jan 19 '23 00:01 mirabilos