Class MovingAverage
- java.lang.Object
-
- dev.nm.dsp.univariate.operation.system.doubles.MovingAverage
-
- All Implemented Interfaces:
Filter
public class MovingAverage extends Object implements Filter
This applies a linear filter to a univariate time series using the moving average estimation.
o is the offset, depending on whether only past values or both past and future values centered around lag 0 are used. When a symmetric window is used and the filter length is even, more of the filter is forward in time than backward.y[i] = f[1]*x[i+o] + … + f[p]*x[i+o-(p-1)]
The R equivalent function is
filter
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MovingAverage.Side
the available types of moving average filtering
-
Constructor Summary
Constructors Constructor Description MovingAverage(double[] filter)
Construct a moving average filter using a symmetric window.MovingAverage(double[] filter, MovingAverage.Side side)
Construct a moving average filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
transform(double[] x)
Transforms the input signal into the output signal.
-
-
-
Constructor Detail
-
MovingAverage
public MovingAverage(double[] filter, MovingAverage.Side side)
Construct a moving average filter.- Parameters:
filter
- the filter coefficients in reverse time orderside
- specify the data window to use
-
MovingAverage
public MovingAverage(double[] filter)
Construct a moving average filter using a symmetric window.- Parameters:
filter
- the filter coefficients in reverse time order
-
-