Figures
Abstract
This work introduces an extension of the iterated moving average filter, called the Extended Kolmogorov-Zurbenko (EKZ) filter for time series and spatio-temporal analysis. The iterated application of a central simple moving average (SMA) filter, also known as a Kolmogorov-Zurbenko (KZ) filter, is a low-pass filter defined by the length of the moving average window and the number of iterations. These two arguments determine the filter properties such as the energy transfer function and cut-off frequency. However, the existing KZ filter is only defined for positive odd integer window lengths. Therefore, for any finite time series dataset there is only a relatively small selection of possible window lengths, determined by the length of the dataset, with which to apply a KZ filter. This inflexibility impedes use of KZ filters for a wide variety of applications such as time series component separation, filtration, signal reconstruction, energy transfer function design, modeling, and forecasting. The proposed EKZ filter extends the KZ and SMA filters by permitting a widened range of argument selection for the filter window length providing the choice of an infinite number of filters that may be applied to a dataset, affording enhanced control over the filter characteristics and greater practical application. Simulations and real data application examples are provided.
Citation: Valachovic EL (2025) An extension of the iterated moving average. PLoS One 20(7): e0328080. https://doi.org/10.1371/journal.pone.0328080
Editor: Agbotiname Lucky Imoize, University of Lagos Faculty of Engineering, NIGERIA
Received: February 10, 2025; Accepted: June 25, 2025; Published: July 10, 2025
Copyright: © 2025 Edward L. Valachovic. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: The article describes theoretical research and data simulation methods. The data underlying example applications presented in the study are available from the National Oceanic and Atmospheric Administration Physical Sciences Laboratory data repository NCEP Reanalysis dataset (https://psl.noaa.gov/data/timeseries/hour/).
Funding: The author(s) received no specific funding for this work.;
Competing interests: The authors have declared that no competing interests exist.
Introduction
In time series data, successive data points, or observations, are ordered in time and are often composed of multiple contributing factors such as trends, periodic components, and random variation. The moving average filter is a useful tool in time series analysis that can help smooth shorter-term variation and benefit the study of longer-term patterns and trends free from the interference of obscuring fluctuations. More on time series analysis including definitions, notation, and examples can be found in Wei in addition to Shumway and Stoffer [1,2]. While other moving average designs are possible, a common moving average design is a central simple moving average (SMA) [3–6]. The SMA filter, with notation , replaces each observation in a time series with an average of a chosen odd positive integer number, m or the filter window length, of sequential observations from the time series centered at the observation being replaced. While other filter designs can assign different weights to the values being averaged, increasing or decreasing their influence, the SMA assigns a weight of one to each observation, so that each has the same influence on the final average.
With the design described above, an helps to smooth short-term fluctuations that occur with a period of m and shorter [4,5]. A few simple examples illustrate the practical applications of an
. Consider for instance, a time series dataset consisting of any purely periodic pattern with a period of m, or equivalently a frequency or reciprocal of the period, 1/m, such as a sinusoidal wave. With the exception the first and last (m-1)/2 observations of the time series, where the SMA filter does not have enough observations to be fully calculated, the
applied to this time series will produce a constant value, the overall mean, everywhere else. Since m equals the period of the sinusoidal wave, the
calculations will be composed of a balanced set of values about the overall mean. Relating observations made along a sinusoid to coordinates of a unit circle, the same idea can be thought of as having any odd number, m, set of points equally dividing the unit circle, where the average of the coordinates of those m points completing the unit circle are equal to zero. Clearly, an
filter is useful to eliminate components with a period of m, or frequency 1/m. Using the same reasoning, the
filter is also able to completely suppress components at the harmonics, or positive integer multiple of the fundamental frequency 1/m. Consider now the same periodic time series, but with a single random fluctuation or interruption to the pattern at one time point. Through the process of averaging, the same
will smooth that fluctuation but not completely suppress its effect upon the surrounding nearest m observation values with which it is averaged. This example illustrates one potential drawback of the
filter since it suppresses or attenuates but does not necessarily eliminate noise or variation that has a period shorter than m.
An extension of the filter was introduced by Zurbenko which improved upon the filter design and more completely suppressed variation with a period less than m, or frequency greater than 1/m [7]. The extension, called the Kolmogorov-Zurbenko (KZ) filter, is the iteration of the SMA filter. With notation
the KZ filter has the two arguments m, the positive odd integer filter window length, and k, the positive integer number of iterations. Therefore, the
filter is equal to the
filter when k = 1. With definitions and properties provided in Yang and Zurbenko, the
filters are a class of low-pass filters, completely attenuating variation within a time series at a frequency of 1/m as well as its harmonics [8]. However, when k > 1, the
filter more fully suppresses all variation that has a period shorter the m, and the level of attenuation can be controlled by the choice of argument k. More detailed analyses on the effect of the choice of the KZ filter arguments and their impact on filter performance for frequency attenuation and data smoothing are found in Zurbenko [7] and Valachovic and Zurbenko [9]. Additional detail on the KZ filter argument choice and the separation of signal frequencies are found in Valachovic [10,11].
Yang and Zurbenko provides the energy transfer function for the KZ filter, which is a mapping that describes how input frequencies are transferred to outputs [8]. More on the energy transfer function can be found in Shumway and Stoffer in addition to Zurbenko [7,12]. The energy transfer function is useful to show the effect of a KZ filter on a time series, and how with only a few iterations, this class of filters, strongly attenuates signals of frequency 1/m and higher while passing lower frequencies. The energy transfer ranges from 1, where all energy or variation present in the time series at that frequency is passed through the filter, down to 0 where no energy or variation at that frequency is passed. Fig 1 provides examples of KZ filters, each with a different color with a fixed argument m, here of just for illustrative purposes, but paired with different choices for the argument of the number of iterations k to exhibit the characteristics of SMA and KZ filters. The energy transfer functions for
is in magenta which is equivalent to an
, for
in red,
in yellow,
in green,
in cyan, and
in blue. Fig 1 on the left displays the energy transfer functions and shows that the attenuation for each is complete at frequency 1/m = 1/7 and its harmonics 2/7 and 3/7, but the
or equivalently
in magenta only modestly suppresses other frequencies greater than 1/m. The advantage of the KZ filters over SMA filters is that higher iterations improve this attenuation. At two iterations in red, the
more completely suppresses these other frequencies between the harmonics of 1/m, but there is still visible evidence of leakage through the filter at higher frequencies. At
and above, in Fig 1 to the left, the energy transfer function does not appear to be visibly different from zero at frequencies greater than 1/m. However, in Fig 1 to the right the natural logarithm of the energy transfer functions reveals that this is not quite the case. As the number of iterations increases the KZ filters both completely attenuate at frequency 1/m and its harmonics, and the degree of attenuation at other frequencies greater than 1/m increases as the energy transfer approaches zero.
The energy transfer function to the left and log energy transfer function to the right for Kolmogorov-Zurbenko filters with a fixed argument of paired with
in magenta,
in red,
in yellow,
in green,
in cyan, and
in blue.
The KZ filter is a notable improvement upon the SMA filter, overcoming the inability of the SMA filter to adequately attenuate frequencies greater than 1/m which limits its use as a low-pass filter. Furthermore, the KZ filter provides direct control through one of its functional arguments, the number of iterations, k, that adjusts the degree of attenuation in this range of frequencies allowing more precise design of the filter for different applications. KZ filters and their extensions are useful to separate portions of the frequency domain to exclude interfering frequencies. These filters have a history of use in a variety of fields such as the environmental sciences, meteorology, and climatology in Wise and Comrie, and Gao et al. [13,14]. KZ filters featured in studying air quality in Kang et al. and Sezen et al. [15,16]. Zhang, Ma, and Kim used KZ filters to study pollution and De Jongh, Verhoest, and De Troch used them to research precipitation patterns [17,18]. Valachovic and Zurbenko uses KZ filters for frequency separation to identify hidden periodically correlated components in skin cancer time series data and perform multivariate analysis on these component factors [19]. Recently, they were used by Valachovic to design a new method called the Variable Bandpass Periodic Block Bootstrap as well as its extension to address a weakness in prior block bootstrapping methods for periodically correlated time series [10,11]. Many of these examples highlight the use of KZ filters to smooth data, reduce random variation, interpolate missing observations, and specifically separate and filter portions of the frequency domain prior to analysis.
However, one design shortcoming of the KZ filter is its constraint in the selection of filter window length. With a design that is restricted to positive odd integers for the argument m, it is severely limiting in the choice of which period or corresponding frequency can be completely suppressed. With choice restricted to positive odd integers, there are continuous interval gaps of possible periodic signal periods that can not be used. Fig 2 shows this shortcoming in a series of example energy transfer functions for KZ filters, each with a fixed argument of but paired with
in red,
in green,
in blue,
in dashed red,
in dashed green,
in dashed blue. Clearly, as m increases, the frequencies suppressed by the energy transfer functions crop near zero following the frequency 1/m which is completely attenuated. As a result, the design options of KZ filters are sparse at relatively small values for the argument m than at higher values of m. Seen in Fig 2, there are only four choices for the filter window length in KZ filters between the frequencies of 0.1 and 0.5.
The energy transfer function for Kolmogorov-Zurbenko filters with a fixed argument of paired with
in red,
in green,
in blue,
in dashed red,
in dashed green,
in dashed blue. The ellipsis shows that there are additional KZ energy transfer functions in this region as m increases.
This is very limiting when designing KZ filters for signal separation and reconstruction. For instance, it may be the case that a component signal with a positive even integer period is the target for filtration. While it is possible to approximate a filter for a signal with an even period using a KZ filter designed with an adjacent odd period, the filtration will be incomplete. Furthermore, as Fig 2 illustrated, the approximation is increasingly poor for smaller values of m. For other examples, even when a signal has an odd integer period, such as a weekly or 7-day period, or yearly 365-day period, if the goal is separating harmonics of the fundamental frequency, those harmonics will have non-integer periods which can not be designed into the KZ filter window length.
There are many different methods to accomplish various aspects of the goals and attributes of SMA and KZ filters, each with their respective implementations, characteristics, advantages, and limitations. For instance, there are other smoothing techniques such as weighted moving averages described in Perry [20], Loess described in Jacoby [21], or types of adaptive smoothing in Shynk [22]. As a low-pass filter there are Bessel, Butterworth, Chebyshev, and Elliptic filters described in Paarmann [23] and Podder et al. [24], and the one-euro filter in Casiez et al. [25]. Zurbenko detailed the theoretical and practical characteristics of the KZ and SMA filters which can be used for a comparison to a variety of different types of filters [7]. Therefore, in this work, the KZ and SMA filters are the standard used for comparison regarding their attributes, uses, strengths, and limitations.
The research question in this work asks if it is possible to design an improvement upon the KZ filter, much as the KZ filter improved upon the SMA filter, permitting a wider and more continuous range beyond the positive odd integers for the filter window length argument within the class of low pass filters represented by the KZ filter design. This is the motivation of this work. The Extended Kolmogorov-Zurbenko (EKZ) filter, introduced here, is designed to solve this limitation in the KZ filter. The EKZ is an iteration of a generalization of a simple moving average filter so that it permits any positive real valued window length and is formally defined in the next section. The EKZ creates the equivalent of a centered and equally weighted moving average, somewhat counterintuitively, using a specially designed non-equally weighted moving average. To accomplish this, it treats a time series, with its original unit time measure, as if it was recorded over intervals of smaller time units, or even continuously. Any positive real valued number greater than one, mr, can be expressed as the sum of the closest positive odd integer less than that real number, mo, and the difference, md, which must be less than two. Therefore, any positive real valued window length, mr, can be used to create an extended central simple moving average formed from the original values of the original time series, with weights 1 for the nearest mo observations surrounding the central time point, and weights equal to half of md for the next farther observations before and after. With this design, the EKZ is identical to a KZ filter if it had it been applied to the time series were measured in finer time units than original. Therefore, the EKZ is an extension of the KZ filter as an iterated simple moving averaged, and it retains many properties of the KZ filter, while permitting a continuous choice of filter window length mr.
Methods
The iterated moving average
The original Kolmogorov-Zurbenko (KZ) filter is the iteration of a central simple central moving (SMA) average defined in Zurbenko [7]. It is a filter with two arguments m, and k, and notation . The argument m, a positive odd integer, is the length of the SMA filter window, and the argument k, a positive integer, is the number of iterations of the SMA. Therefore, the
is a special case of the
filter, when k = 1. KZ filters are a type of low-pass filter that completely attenuates signals at frequency 1/m and its integer multiples, or harmonics, and strongly attenuates all signals of frequency 1/m and higher while passing lower frequencies. This can be useful to suppress periodic variation in examples with data measured daily and averaging
days for a weekly periodic component or averaging
days for the length of the year of an annual component. These are permissible with SMA and KZ filters because they are positive odd integer window lengths. The effect of a
filter is smoothing the time series regarding the variation that occurs with period m or shorter. The equations below follow the notation found in Zurbenko, and Yang and Zurbenko [7,8]. Applied to a time series process
, a KZ filter of m data-points and k iterations, where t is time ordering the data-points, u are the time steps defining the symmetric centered filter window, and
are coefficient weights, is defined as follows:
The coefficients can be conveniently found as the polynomial coefficients obtained from an expansion of the following polynomial (arbitrarily in z):
The coefficients are obtained by the convolution of k uniform discrete distributions on the interval where m is an odd integer. Therefore, each coefficient forms a tapering window which has finite support. For some examples calculating the coefficients, a
filter would have an ordered sequence of
coefficients
like an SMA3, and a
filter would have ordered sequence of
coefficients
.
The KZ filter can be applied with statistical software in an iterated form using R Studio software packages such as KZA detailed in Close and Zurbenko [26,27]. The iterated form of the Kolmogorov-Zurbenko filter can be produced according to the following algorithm found in Yang and Zurbenko along with the following equations [8]. In the iterated form of the filter each step is an application of a
filter, or equivalently an
moving average filter of length m, to the prior result thus making all
coefficients equal to one in each step. The iterated form of the
is provided in the following equations:
Additionally, Zurbenko, and Yang and Zurbenko, introduce the energy transfer function for the KZ filter, which is the square of the linear mapping that describes how input frequencies are transferred to outputs and as such is symmetric about zero [7,8]. The energy transfer function is useful to show the effect of a KZ filter on a time series, and how with only a few iterations, this class of filters, strongly attenuates signals of frequency 1/m and higher while passing lower frequencies. The energy transfer function of the KZ filter at each frequency λ is seen in the following equation:
The KZ energy transfer function is also useful to define the cut-off frequency which is a limit or boundary at which the energy transferred through a filter is generally suppressed or diminished rather than allowed to pass through. A cut-off frequency where output power is half that of the input, called the half power point, for the KZ filter energy transfer function is provided by Zurbenko, and Yang and Zurbenko, below [7,8].
The Extended Iterated Moving Average
The proposed extension to the iterated moving average introduced here, equivalent to an extension of the KZ filter which itself is an extension of the SMA filter, is called the Extended Kolmogorov-Zurbenko (EKZ) filter. The design of the EKZ arises from an aim to define a central SMA or KZ filter over both ever shorter and finer time units. By design a central SMA filter averages all data observations with equal weight in the filter window length. Similarly, the KZ filter balances the number of observations before, and after which centralizes the filter and results in the limitation to only positive odd integer window lengths. Rather than equally weighting observations, in order to define a central equally weighted moving average for numbers other than positive odd integer window lengths, the proposed EKZ creates an extension of the KZ filter by iterating a specially, and unequally, weighted central moving average filter on a positive odd integer window length. In effect, the EKZ filter creates moving averages that are equal to what they would be with KZ filters, were the data recorded finely enough so that the desired window length was a positive odd integer. This permits the EKZ to be applied as if it were an SMA applied to any window length, including those that are not positive odd integer lengths. This can be useful to suppress periodic variation in examples with data measured hourly and averaging 24 hours for a daily periodic component, or data measured daily and averaging 365.25 days for the more accurate length of the year of an annual component. Each of these are not possible with SMA and KZ filters because they are not positive odd integer window lengths. Therefore, it is a filter with notation and with two arguments mr, and k, where the argument mr is any positive real number greater than one for the filter window length. The argument k remains a positive integer for the number of iterations. As noted previously, where a
filter is equivalent to an
moving average filter of length m, by extension, an
filter is equivalent to an extension of an SMA filter for filter length mr, which can be called an
.
To derive and define the EKZ filter, let be a time series where t is time. For an
filter of a positive real valued filter window length of mr > 1 time points and positive integer k iterations, define
time points where
is the nearest positive odd integer less than
, and
is the difference equal to
. Clearly, it must be that
. For simplicity, lets consider
iterations, or an
, since the
is and an
filter iterated
times. If
, then
is a positive odd integer, and our constructed expression for the EKZ should be identical to the KZ expression. If
then
is not a positive odd integer, which means
is the nearest positive odd integer less than
, so an SMA averaging over a window length
would involve summing over too few equally weighted observations. Also, an SMA of window length
would sum over too many equally weighted observations for the desired window length of
. Therefore, the central non-simple moving average design of the ESMA will first sum the central
equally weighted observations, with weights of one, and the next two more distant observations each weighted by one half of the remaining
. The ESMA calculation will sum
observations, but with weights summing to, and averaged over,
Then an
filter of mr time points and k iterations, where u are the steps defining the symmetric filter window, and
are coefficient weights, is defined as follows:
The coefficients can be conveniently found as the polynomial coefficients obtained from an expansion of the following polynomial (arbitrarily in z):
The coefficients are obtained by the convolution of k uniform discrete distributions on the interval where mo is an odd integer, and each coefficient forms a tapering window which has finite support. As described above, the differences in the EKZ filter definition from the KZ filter definition are the wider lower and upper limits of the summation and the average over the
window length of the denominator in equation 8, and in equation 9 the first and last coefficients in the polynomial expansion are
rather than one. For some examples calculating the coefficients, an
filter would have an ordered sequence of
coefficients
. An
filter would have an ordered sequence of
coefficients
. Lastly, a
would have ordered sequence of
coefficients
.
In the iterated form of the filter each step is an application of an
filter, or equivalently an
, to the prior result. In this form, since k = 1 in each step, all
coefficients are equal to one in each step except for the first and last coefficients provided
. The iterated form of the
is provided in the following equations:
EKZ filters inherit or are approximated by many of the properties of KZ filters, because KZ filters are a special subset of EKZ filters when argument mr = m as a positive odd integer. First, compared to the KZ filter’s iterated equally weighted average calculation, the EKZ filter’s marginally more complex iterated specially weighted average means the difference in computational efficiency is insignificant. Next, just like the KZ filter, the filter smooths variation in a time series that occurs with period mr or shorter and smooths more completely with greater iterations [7–10]. To better understand the properties, three cases must be considered: when the window length is a positive odd integer, when it is a positive even integer, and when it is any other real number greater than one. EKZ filters where mr = m, a positive odd integer, mathematically simplify to KZ filters, which completely attenuates signals at frequency 1/m and its multiples, or harmonics, and strongly attenuates all signals of frequency 1/m and higher while passing lower frequencies [7,8]. This was described earlier with an example of a sinusoidal wave of period m. With the exception of the beginning and ending observations of the time series, where the filter is not completely implemented, the
just like the
or
filter will produce a constant value, the overall mean, everywhere else. Again, since m equals the period of the sinusoidal wave, the
calculations will be composed of a balanced set of values about the overall mean. Equivalently, the same idea can be thought of as having any odd number m, set of points equally dividing the unit circle, where the average of the coordinates of those m points completing the unit circle are equal to zero.
When mr is a positive even integer, a case that the KZ and SMA filter can not accommodate, the EKZ filter also completely attenuates signals at frequency 1/mr and harmonics, and strongly attenuates all signals of frequency 1/mr and higher while passing lower frequencies. For a sinusoidal wave of period mr, with the exception the beginning and ending observations of the time series, where the filter is not completely applied, the will produce a constant value, the overall mean, everywhere else. Since mr equals the period of the sinusoidal wave, the calculations of the EKZ will still be composed of a balanced set of values about the overall mean. However, since mr is even, each calculated average will contain mr + 1 = mo + 2 values, including the central most mo values, and the two next closest values, one preceding and one following but each weighted by half. Equivalently, this time the idea can be thought of as having any even number, mr, set of points equally dividing the unit circle. The EKZ averages mr + 1 = mo + 2 values, weighting mo values by one, and repeating the last value in the calculation twice, but at the same time weighting the repeated values by half. This is equivalent to an average of the mr set of points and that average always equals zero.
However, when mr is any other real number greater than one, the properties of the EKZ filter are only approximated by the properties of the KZ filter. When mr is any other real number greater than one, the EKZ filter very strongly attenuates, but not completely attenuates, signals at frequency 1/mr and harmonics, while it still passes lower frequencies and strongly attenuates all signals of frequency 1/mr and higher. In the case of a sinusoidal wave of period mr, no integer fully divides mr, and the calculations of the EKZ will be close to but no longer be composed of a balanced set of values about the overall mean. The reason the EKZ calculations will be close to but not exactly equal to the overall mean can again be seen by considering the unit circle. In this case, the unit circle is divisible by mr points but not by an integer due to the fixed size of the unit measure of the time series. So, mo points and corresponding equal size intervals do not completely divide the unit circle or one cycle of period mr, and mo + 2 intervals are more than the unit circle. Therefore, the EKZ calculation averaging a set of mo points weighted by one, and the two next closest points by half of md = mr – mo, will be close to but not exactly equal to zero. Since not all EKZ averages are equal, variation at a frequency of 1/ mr as well as its harmonics are strongly but not completely suppressed or eliminated.
Therefore, the energy transfer function inherited from the KZ filter is best considered as only approximate for the EKZ filter at each frequency λ, specifically the same when mr is a positive odd greater than one, and approximate for all other values greater than one, and is seen in the following equation:
Likewise, the cut-off frequency where output power is half that of the input, or the half power point, for the EKZ filter energy transfer function is approximated by the equation provided below:
Fig 3 shows example energy transfer functions for multiple EKZ filters over a small range of filter window lengths, many of which are not possible with KZ or SMA filters. To demonstrate flexibility, Fig 3 shows EKZ filters with the number of iterations fixed at k = 1, and the moving average window length ranging from mr = 1 to mr = 7 by one-unit intervals, in black,
in magenta,
in red,
in yellow,
in green,
in cyan, and
in blue. Between each one-unit interval, other values of mr are permitted, and to illustrate the range of possible filter designs additional EKZ filters are shown with
increasing in one tenth units. Of course, this is only illustrative of the range of EKZ filters possible, of which there are an infinite number where
takes any real number within this range. For comparison, there are only three KZ filters, or equivalently SMA filters, in the same range where m = 3, 5, or 7, and whose energy transfer functions are identified by the black dashed lines in Fig 3. Finally, more filters are possible as mr increases above 7, and the energy transfer function becomes more compact around the zero-frequency indicated by the ellipsis in Fig 3.
The energy transfer function for Extended Kolmogorov-Zurbenko filters with arguments and
in black,
in magenta,
in red,
in yellow,
in green,
in cyan, and
in blue, in addition to mr within each created interval. The lines with black dashes are the only possible energy transfer functions for KZ filters in the same range of argument m at
in red,
in green, and
in blue.
Simulations
To illustrate the use of the EKZ filter proposed here as well as the results obtain from their application, this work simulates a time series and applies EKZ, or extended iterated moving average, filters with arguments that are not possible with KZ or SMA filters. Periodograms, which are described in Zurbenko, and Shumway and Stoffer, and illustrate sample variance at each frequency within a time series, provide a visual tool to observe the varied effects of different EKZ and KZ filters upon the original time series [7,12].
Analysis is performed in R version 4.1.1 (2013) statistical software using the KZ function in the KZA package, see Close and Zurbenko for more detail, with datasets as a time series measured on an ordered interval dimension, in this case time [26,27]. The simulated time series is constructed with 100,000-time units. First, a time series of random variation or white noise is generated with independent draws from a standard normal distribution with mean zero and standard deviation one. The periodogram of this white noise time series data is seen in Fig 4, plotted using R in black, and exhibits random low fluctuating levels of energy across all frequencies which is characteristic of white noise. The periodogram of an filter applied to this time series in magenta, exhibits the successful smoothing and complete suppression of variation at a frequency of
. This matches the energy transfer function of an
filter plotted as the magenta curve with corresponding scale on the right. The periodogram of a second iteration of the
filter, equivalent to an
of the white noise time series, is seen in dark magenta. Note that the
still completely suppresses variation at a frequency of
. This matches the energy transfer function of an
filter plotted as the dark magenta curve. For comparison, the closest possible KZ, or equivalent SMA, filter to the
has the energy transfer function displayed in red with
and
, which would clearly not suppress variation at a frequency of 1/2. The difference in the results between the closest KZ filter and the EKZ filter at the target frequency of 1/2 can be quantitatively measured by the residual energy at that frequency. After a
the residual energy is approximately 11.06% of the initial energy while that of a
is 0.00029%. This shows the superior performance of the EKZ fully suppressing frequencies that can not be targeted by KZ filters.
The periodogram of a white noise time series in black and the periodograms of that same time series after applying Extended Kolmogorov-Zurbenko filters in magenta, and
in dark magenta. The energy transfer functions of an
filter is shown as the magenta curve,
in dark magenta, and the closest
, or equivalent
, filter energy transfer function displayed in red with corresponding scale on the right.
In a second example, an EKZ filter with an example fractional window length is applied to the same white noise time series as the first example. This is not possible with the KZ filter. Due to small values, the log periodogram of the same white noise time series data is seen in Fig 5, plotted in black. The log periodogram of an filter applied to this time series in yellow, exhibits the successful smoothing and strong suppression of variation at a frequency of
. This matches the approximate energy transfer function of an
filter plotted as the yellow curve with corresponding scale on the right. For comparison, the closest possible KZ filters
and
have the energy transfer function displayed in red and green respectively. The difference in the results between the closest KZ filters and the EKZ filter at the target frequency of
can be quantitatively measured by the residual energy at that frequency. After a
the residual energy is approximately 8.48% of the initial energy while a
has residual energy of approximately 4.91% compared to the
with 0.00895%. This again shows the performance gain of the EKZ to more fully suppress frequencies that can not be targeted by KZ filters.
The log periodogram of a white noise time series in black and the periodograms of that same time series after applying Extended Kolmogorov-Zurbenko filters in yellow. The approximate energy transfer functions of the
filter is shown as the yellow curve, and the closest possible
displayed in red and
displayed in green with corresponding scale on the right.
Real data applications
The practical use for researchers and potential advantages of the EKZ filter over the KZ filter can be demonstrated in several real data applications. These applications are provided as illustrative examples of the potential uses and operation of the EKZ filter and is only intended as a demonstration. In the first example of a real-world application with an EKZ filter, atmospheric surface pressure records near Seattle, Washington, USA, at 47°46’35.0“N latitude and 122°19’59.0”W longitude, are used from the National Oceanic and Atmospheric Administration Physical Sciences Laboratory data repository NCEP Reanalysis dataset [28]. Data is provided by the NOAA Physical Sciences Laboratory, Boulder, Colorado, USA, from their website at https://psl.noaa.gov/. These records are measured in Pa, or Pascals, and are recorded at equal 6-hour intervals four times daily between January 1st, 2010, through December 31st, 2010 [29]. The time series has 1,460 observations. Analysis is performed in R version 4.1.1 (2013) statistical software [26].
The research application may require isolating and eliminating, or alternatively retaining with the combined use of a difference filter, the daily variation exhibited in the time series. The goal here is to apply a filter that completely suppresses variation that occurs over daily periods. While the SMA and KZ filters can set the window length to either m = 3 or 5, and this may be sufficient for some purposes, with measurements recorded four times daily completely suppressing daily variation require a moving average with filter window length of four observations. The EKZ filter provides the flexibility to assign the window size to mr = 4. Fig 6 shows the Seattle surface pressure time series in black and the filtered time series in yellow. For comparison, the
filtered time series is in red, and the
filtered time series is in green. Fig 6 shows at times noticeable differences between these filters. This result is not surprising given there are significant differences between the energy transfer functions identified in Fig 3, red and green with black dashes for the KZ filter with m = 3 and 5 respectively, and yellow for an EKZ filter with mr = 4 in yellow. With these three filters, 1/m is substantially different, as is the case when m is small.
The Seattle, Washington surface pressure time series in black and the filtered time series in yellow,
filtered time series is in red, and the
filtered time series is in green.
In the second example of a practical application with an EKZ filter, daily noon precipitation rate records near New York City Hall, New York, USA, at 40°42’46.0“N latitude and 74°00’21.0”W longitude, are used from the National Oceanic and Atmospheric Administration Physical Sciences Laboratory data repository NCEP Reanalysis dataset [28]. These records are measured in Kg/m2/s and are recorded between January 1st, 1960, through December 31st, 2019 [29].
For a variety of purposes such as research into linear trends, long term trends, or multiyear patterns, it may be necessary to separate, filter, and eliminate the strong seasonal pattern exhibited in the time series. The goal would be to apply a filter that completely suppresses variation that occurs seasonally, or with a period of one year. This process may typically involve using a simple moving average of 365 days, the or equivalently
, or possibly an iterated
filter with k > 1 which would strongly suppress all shorter period variation as well. However, depending upon the required precision for the filter this can be problematic for at least two reasons, since the 365-day period only approximates the annual period, and the dataset contains an additional leap year observation every four years, making these filters not as accurate as they could be. A more accurate annual period would be 365.25 days, and for yet greater accuracy a period of 365.256363004 days is closer to the true annual period in days. The SMA and KZ filters can potentially set the window length to either 365 or 367. Since m in this example is large compared to the previous example, the difference between the frequency 1/m for these filters will be small. While any of these may be sufficient for some purposes, they do not have the flexibility of the EKZ filter to assign the window size as arbitrarily close to the annual period as desired. Fig 7 shows the New York City precipitation rate time series in black and the
filtered time series in red. In practice, for this example, only a very small difference results between the
,
, and the
filters, and it is too small to visualize in Fig 7. Still, the difference is measurable between the filter results and the EKZ produces results that more accurately targets suppression of the annual periodic variation from the time series. This example demonstrates the potential use of the greater flexibility of the EKZ filter.
The New York City precipitation rate time series in black and the filtered time series in red.
With examples such as these, the practical implications of using the EKZ filter could potentially result with modeling of improved accuracy on specific periodic components in weather forecasting such as daily patterns or seasonality. Alternatively, the EKZ filter could be used to exclude natural variation at certain frequencies to investigate change attributed to other factors now free from the influence of cyclic patterns such as an investigation into climate trends. As the examples showed, more precise extraction or suppression of certain frequencies from time series applications would result in more accurate modeling with the EKZ filter, often where the use of KZ filters in the alternative would be imprecise or approximate at best.
Discussion
The central SMA filter is a useful tool in time series analysis to smooth data, and to completely suppress signals with a period equal to the length of the SMA filter window, as well as its harmonic frequencies. However, most signals with a period shorter than the window filter length are not completely suppressed, and certain high frequencies have a substantial amount of leakage, or energy that passes through the filter. This makes the SMA a relatively poor low-pass filter. The KZ filter improves upon the SMA and is more effective at attenuating signals with a period shorter than the window filter length by iterating the SMA. The KZ filter creates a better low-pass filter than the SMA, particularly with higher iterations. However, both the KZ and SMA filters are limited because they are only defined for positive odd integer window sizes. This creates a set of filters that has gaps between the frequencies that are capable of being eliminated. This problem is particularly apparent at low positive odd integer values, which account for the largest intervals of the frequency range. The introduction of the EKZ filter in this work helps to fill those gaps, making a much more flexible low-pass filter and overcomes some of the shortcomings of the KZ and SMA filters.
The results from the real data applications presented, illustrate potential applied research need and practical applications of the EKZ filter where KZ and SMA filters are inadequate. The EKZ filters in those examples demonstrate just a few of the factors such as annual cycles or daily patterns that, whether natural and human made, may contribute as periodic components in time series that require suppression or extraction as part of a full time series analysis of different data. It is possible to imagine examples concerning climate, weather, econometrics, geophysics, the environment, and epidemiology. These examples also indicate the diversity of research fields that may benefit from the advantages of EKZ filters over more simple and less precise KZ and SMA filters.
The first such advantage of the EKZ is that it contains the KZ and SMA filters as special cases, so each of those types of filters and their attributes are achievable. The next advantage of the EKZ is that it permits the use of positive even integer window sizes. This can be done while maintaining the ability of the filter to strongly attenuate signals with a period shorter than the filter window length, while completely eliminating signals with a period equal to, or a multiple of, the filter window length. Just by permitting positive even integer window sizes, the EKZ approximately doubles the number of filter designs that are possible compared to KZ filters while maintaining the same attributes. However, when the filter window length is any real number greater than one excluding even and odd integers, the EKZ filter does have limitations to the suppression of certain frequencies. In this case the EKZ filter still strongly suppresses signals with a period shorter than the filter window length, but it no longer completely eliminates signals with a period equal to, or a multiple of, the filter window length. Despite that limitation in this case, the EKZ filter can still be an effective low-pass filter, with a now continuous choice of filter window size, and even though it does not always completely suppress signals with a period equal to, or a multiple of, the filter window length, the level of suppression can be controlled though iteration. Additional limitations of the EKZ filter include instances where the SMA or KZ filter are sufficient for the research purposes. For instance, in smoothing noisy data, where strong high frequency suppression is not the goal, an SMA filter may be optimal compared to either the KZ or EKZ filter. Furthermore, if suppression of high frequencies is not targeted such as separating widely different frequencies, the less refined and precise KZ filter may be sufficient when compared to the EKZ filter. However, it is worth while remembering that while the EKZ filter is marginally more complex, it accommodates all possible SMA and KZ filters as special cases.
Another advantage of the EKZ filter, is the relative ease of calculation in its iterative form, a feature it shares with KZ and SMA filters. While the EKZ can be programmed into statistical software, it is also possible to calculate in most spreadsheet programs. As cited earlier, the KZ filter has seen extensive use in time series for signal separation, component signal reconstruction, multivariate analysis, and forecasting. In some cases, the KZ or even SMA filter may be sufficient to perform these functions. However, the KZ and SMA filters are less precise tools than the EKZ, and there may be applications where the precision and fine adjustment possible with the EKZ may be necessary, such as the real data application examples provided. It is possible to imagine a dataset with two component periodic signals with different but very close frequencies. To separate the two component signals it may be necessary to use a filter to split those frequencies, passing one and attenuating the other. There are scenarios where this may not be possible with KZ filters, but the task can be accomplished through the flexibility of the EKZ. One recommendation to emerge from this work is to conduct a future detailed exploration of the practical limitations of the EKZ as part of an extensive simulation study across different scenarios of research factors such as signal-to-noise ratio and component frequency range.
Conclusion
In time series analysis, the SMA is often used to smooth the time series and reduce shorter period, higher frequency, variation. The KZ filter extended the simple moving average and provided greater control over the frequencies which are attenuated and those that are allowed to pass through the filter, and how much attenuation is used. However, both SMA and KZ filters do not permit sufficient flexibility in choosing the length of the filter window over which the moving average is applied, preventing precise design of the filters. Since they suppress frequencies of 1/m and shorter, where m is the chosen filter window but is restricted to positive odd integers, at times they provide what can best be described as a blunt tool for this task. The problem is most pronounced for small values of m, with shorter period signals and higher frequencies, since the corresponding frequency gaps created by the frequencies 1/m are substantial. The EKZ filter proposed here extends both the KZ and SMA filters to permit a continuous selection of filter window lengths across the same range. As a result, the frequency specifically chosen for attenuation by the filter is no longer limited to the values of 1/m, but to any real value greater than one. The EKZ creates a much more precise tool with many potential future applications.
Acknowledgments
Thank you to the College of Integrated Health Sciences, University at Albany, State University of New York.
References
- 1.
Wei W. Chapter 2, Fundamental concepts. Time series analysis: univariate and multivariate methods. Redwood City, California: Addison-Wesley. 1989;6–30.
- 2.
Shumway RH, Stoffer DS. Chapter 1, Characteristics of Time Series. Time Series Analysis and Its Applications. Springer International Publishing. 2017. https://doi.org/10.1007/978-3-319-52452-8
- 3.
Wei W. Chapter 8.2.2, Moving average method. Time series analysis: univariate and multivariate methods. Redwood City, California: Addison-Wesley. 1989.
- 4.
Shumway RH, Stoffer DS. Chapter 1.2, Time Series Statistical Models. Time Series Analysis and Its Applications. Springer International Publishing. 2017. https://doi.org/10.1007/978-3-319-52452-8
- 5. Johnston FR, Boyland JE, Meadows M, Shale E. Some properties of a simple moving average when applied to forecasting a time series. Journal of the Operational Research Society. 1999;50(12):1267–71.
- 6. Svetunkov I, Petropoulos F. Old dog, new tricks: a modelling view of simple moving averages. International Journal of Production Research. 2017;56(18):6034–47.
- 7.
Zurbenko I. The spectral analysis of time series. New York: North-Holland. 1986.
- 8. Yang W, Zurbenko I. Kolmogorov–Zurbenko filters. WIREs Computational Stats. 2010;2(3):340–51.
- 9. Valachovic E, Zurbenko I. Separation of spatio-temporal frequencies. J Res Appl Math. 2017;3(7):29–37.
- 10. Valachovic EL. Periodically correlated time series and the Variable Bandpass Periodic Block Bootstrap. PLoS One. 2024;19(9):e0310563. pmid:39288169
- 11. Valachovic E. The Variable Multiple Bandpass Periodic Block Bootstrap for Time Series With Multiple Periodic Correlations. Journal of Probability and Statistics. 2025;2025(1).
- 12.
Shumway RH, Stoffer DS. Chapter 4, Spectral Analysis and Filtering. Time Series Analysis and Its Applications. Springer International Publishing. 2017. https://doi.org/10.1007/978-3-319-52452-8
- 13. Wise EK, Comrie AC. Extending the Kolmogorov-Zurbenko filter: application to ozone, particulate matter, and meteorological trends. J Air Waste Manag Assoc. 2005;55(8):1208–16. pmid:16187590
- 14. Gao S, Bai Z, Liang S, Yu H, Chen L, Sun Y, et al. Simulation of surface ozone over Hebei province, China using Kolmogorov-Zurbenko and artificial neural network (KZ-ANN) combined model. Atmospheric Environment. 2021;261:118599.
- 15. Kang D, Hogrefe C, Foley KL, Napelenok SL, Mathur R, Trivikrama Rao S. Application of the Kolmogorov–Zurbenko filter and the decoupled direct 3D method for the dynamic evaluation of a regional air quality model. Atmospheric Environment. 2013;80:58–69.
- 16. Sezen I, Ercelik E, Ghale YAG, Deniz A, Unal A. Application of Kolmogorov-Zurbenko filter to quantify the long-term meteorological and emission impacts on air quality. Atmospheric Research. 2023;288:106714.
- 17. Zhang Z, Ma Z, Kim S-J. Significant Decrease of PM2.5 in Beijing Based on Long-Term Records and Kolmogorov–Zurbenko Filter Approach. Aerosol Air Qual Res. 2018;18(3):711–8.
- 18. De Jongh ILM, Verhoest NEC, De Troch FP. Analysis Of A 105‐year time series of precipitation observed at Uccle, Belgium. Intl Journal of Climatology. 2006;26(14):2023–39.
- 19. Valachovic E, Zurbenko I. Multivariate analysis of spatial-temporal scales in melanoma prevalence. Cancer Causes Control. 2017;28(7):733–43. pmid:28466108
- 20.
Perry MB. The Weighted Moving Average Technique. Wiley Encyclopedia of Operations Research and Management Science. Wiley. 2011. https://doi.org/10.1002/9780470400531.eorms0964
- 21. Jacoby WG. Loess:. Electoral Studies. 2000;19(4):577–613.
- 22. Shynk JJ. Frequency-domain and multirate adaptive filtering. IEEE Signal Process Mag. 1992;9(1):14–37.
- 23. Paarmann LD. Bessel Filters. Design and Analysis of Analog Filters: A Signal Processing Perspective. 2001:113–232.
- 24. Podder P, Mehedi Hasan Md, Rafiqul Islam Md, Sayeed M. Design and Implementation of Butterworth, Chebyshev-I and Elliptic Filter for Speech Signal Analysis. IJCA. 2014;98(7):12–8.
- 25.
Casiez G, Roussel N, Vogel D. 1€ filter: a simple speed-based low-pass filter for noisy input in interactive systems. In: Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, 2012. 2527–30. https://doi.org/10.1145/2207676.2208639
- 26.
R Core Team. R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. 2013.
- 27.
Close B, Zurbenko I. Kolmogorov-Zurbenko adaptive filters. 2013.
- 28. Kalnay E, Kanamitsu M, Kistler R, Collins W, Deaven D, Gandin L, et al. The NCEP/NCAR 40-year reanalysis project. Bull Amer Meteor Soc. 1996;77:437–70.
- 29. NOAA Physical Sciences Laboratory. Access and analyze hourly weather/climate time series. https://psl.noaa.gov/data/timeseries/hour/. 2024 November 18.