MovingMap
MovingMap[f,data,w]
applies f to size w windows in the specified data.
MovingMap[f,data,wspec]
uses windows specified by wspec.
MovingMap[f,data,wspec,padding]
pads data using padding.
Details




- MovingMap can be used for regularly spaced data and for irregularly spaced data.
- In many contexts, the ti are times.
- The data can be a list of values {x1,x2,…}, a list of time-value pairs {{t1,x1},{t2,x2},…}, a TimeSeries, EventSeries, or TemporalData.
- A function f of a single argument gets applied to a list of values {xi,xi+1,…} for each window. »
- A pure function f can access values, times, boundary values, and boundary times for each window using the following arguments: »
-
#Values or #1 data values within the window #Times or #2 data times within the window #BoundaryValues or #3 resampled values at window boundaries #BoundaryTimes or #4 times at window boundaries #Dates or #5 data dates within the window - By default, f is expected to compute a single value for each window and the time is computed automatically. Using a function f that gives output as rules {τi,…}{vi,…} allows control over both time and value as well as producing multiple values per window. »
- The full window specification wspec is a triple {size,align,wpos}, where wpos determines time positions of each window, and size and align specify overall size and alignment that applies to all windows relative to the window positions wpos. »
- Window placements {τ1,…,τm} are specified by wpos. With data time stamps {t1,…,tn}, wpos can be one of the following:
-
Automatic use data time stamps τi=ti {τmin,τmax} use τi=tk+i such that τmin≤tk+i≤τmax {Automatic,τmax} equivalent to {t1,τmax} {τmin,Automatic} equivalent to {τmin,tn} {τmin,τmax,dτ} use τ1=τmin, τ2=τmin+dτ, etc. {{τ1,…,τm}} use explicit τ1, τ2, etc. - By default, the time stamps of the output are {τ1,…,τm}.
- Window size can be given as the following:
-
w positive number, taken to mean days Quantity[w,timeunit] duration w in units of timeunit Quantity[n,"Events"] events count n defines the window size - The window size may be varying in an absolute sense when referring to relative units such as "Month" or "Events".
- Window alignment align determines relative position of τi within the window. The possible settings include Right (default), Left, and Center.
- Window specification {size,align} is equivalent to {size,align,Automatic}.
- Window specification size or {size} is equivalent to {size,Right,Automatic}.
- Settings for padding include:
-
Automatic only keep non-overhanging windows (default) None no padding, keep all windows valuepadding equivalent to {Automatic,valuepadding} {timepadding,valuepadding} padding settings for times and values - Settings for valuepadding can be any valid specification recognized by ArrayPad.
- Settings for timepadding include:
-
Automatic pad uniformly median time-step size Δt pad uniformly with step-size Δt {Δt1,Δt2,…} cyclically pad with steps Δti "ReflectedDifferences" reflections of the differences between times "PeriodicDifferences" cyclically pad with steps ti+1-ti - MovingMap threads pathwise for multipath data.



Examples
open all close allBasic Examples (3)
Scope (30)
Applications (10)
Properties & Relations (5)
Neat Examples (2)
Introduced in 2014
Updated in 2015
(10.0)
|
(10.1)