Class MovingAverageByExtension

  • All Implemented Interfaces:
    Filter

    public class MovingAverageByExtension
    extends Object
    implements Filter
    This implements a moving average filter with these properties: 1) both past and future observations are used in smoothing; 2) the head is prepended with the first element in the inputs (x_t = x_1 for t < 1); 3) the tail is appended with the last element in the inputs (x_t = x_n for t > n). When the filter length is even, more of the filter is forward in time than backward. Note that both past as well as future values are used in generating the outputs. Be cautious to use this in a forecasting model.
    • Constructor Detail

      • MovingAverageByExtension

        public MovingAverageByExtension​(double[] filter)
        Construct a moving average filter with prepending and appending.
        Parameters:
        filter - the filter coefficients in reverse time order
    • Method Detail

      • transform

        public double[] transform​(double[] x)
        Description copied from interface: Filter
        Transforms the input signal into the output signal.
        Specified by:
        transform in interface Filter
        Parameters:
        x - the input signal
        Returns:
        the filtered signal