Kolmogorov–Zurbenko filter
Within statistics, the Kolmogorov–Zurbenko (KZ) filter was first proposed by A. N. Kolmogorov and formally defined by Zurbenko. It is a series of iterations of a moving average filter of length "m", where "m" is a positive, odd integer. The KZ filter belongs to the class of low-pass filters. The KZ filter has two parameters, the length "m" of the moving average window and the number of iterations "k" of the moving average itself. It also can be considered as a special window function designed to eliminate spectral leakage. Background. A. N. Kolmogorov had the  original idea for the KZ filter during a study of turbulence in the Pacific Ocean. Kolmogorov had just received the International Balzan Prize for his law of 5/3 in the energy spectra of turbulence. Surprisingly the 5/3 law was not obeyed in the Pacific Ocean, causing great concern. Standard fast Fourier transform (FFT) was completely fooled by the noisy and non-stationary ocean environment. KZ filtration resolved the problem and enabled proof of Kolmogorov's law in that domain. Filter construction relied on the main concepts of the continuous Fourier transform and their discrete analogues. The algorithm of the KZ  filter came from the definition of higher-order derivatives for discrete functions as higher-order differences. Believing that infinite smoothness in the Gaussian window was a beautiful but unrealistic approximation of a truly discrete world, Kolmogorov chose a finitely differentiable tapering window with finite support, and created this mathematical construction for the discrete case. The KZ filter is robust and nearly optimal. Because its operation is a simple Moving Average (MA), the KZ filter performs well in a missing data environment, especially in multidimensional time series where missing data problem arises from spatial sparseness. Another nice feature of the KZ  filter is that the two parameters have clear interpretation so that it can be easily adopted by specialists in different areas. A few software packages for time series, longitudinal and spatial data have been developed in the popular statistical software R, which facilitate the use of the KZ filter and its extensions in different areas. I.Zurbenko Postdoctoral position at UC Berkeley with Jerzy Neyman and Elizabeth Scott provided a lot of ideas of applications supported in contacts with Murray Rosenblatt, Robert Shumway, Harald Cramér, David Brillinger, Herbert Robbins, Wilfrid Dixon, Emanuel Parzen, see bottom picture Igor Zurbenko with E.Parzen, T.W.Anderson  and Department of Statistics UC Berkeley. Definition. KZ Filter Let formula_1 be a real-valued time series, the KZ filter with parameters formula_2 and formula_3 is defined as where coefficients are given by the polynomial coefficients obtained from equation From another point of view, the KZ filter with parameters formula_2 and formula_3 can be defined as formula_3 time iterations of a moving average (MA) filter of formula_2 points. It can be obtained through iterations. First iteration is to apply a MA filter over process formula_11 The second iteration is to apply the MA operation to the result of the first  iteration, Generally the "k"th iteration is an application of the MA filter to the ("k" − 1)th iteration. The iteration process of a simple operation of MA is very convenient computationally. Properties. The impulse response function of the product of filters is the convolution of impulse responses. The coefficients of the KZ filter , can be interpreted as a distribution obtained by the convolution of "k" uniform discrete distributions on the interval where "m" is an odd integer. Therefore, the coefficient forms a tapering window which has finite support . The KZ filter has main weight concentrated on a length of with  weights vanishing to zero outside. The impulse response function of the KZ filter has continuous derivatives and is asymptotically Gaussian distributed. Zero derivatives at the edges for the impulse response function make from it a sharply declining function, what is resolving in high frequency resolution. The energy transfer function of the KZ filter is It is a low-pass filter with a cut-off frequency of Compared to a MA filter, the KZ filter has much better performance in terms of attenuating the frequency components above the cutoff frequency. The KZ filter is essentially a repetitive MA filter. It is  easy to compute and allows for a straightforward way to deal with missing data. The main piece of this procedure is a simple average of available information within the interval of m points disregarding the missing observations within the interval. The same idea can be easily extended to spatial data analysis. It has been shown that missing values have very little effect on the transfer function of the KZ filter. Arbitrary "k" will provide "k" power of this transfer function and will reduce side lobe value to . It will be a perfect low pass filter. For practical purposes a choice  of "k" within a range 3 to 5 is usually sufficient, when regular MA ("k" = 1) is providing strong spectral leakage of about 5%. Optimality. The KZ filter is robust and nearly optimal. Because its operation is a simple moving average, the KZ filter performs well in a missing data environment, especially in multidimensional time and space where missing data can cause problems arising from spatial sparseness. Another nice feature of the KZ filter is that the two parameters each have clear interpretations so that it can be easily adopted by specialists in different areas. Software implementations for time  series, longitudinal and spatial data have been developed in the popular statistical package R, which facilitate the use of the KZ filter and its extensions in different areas. KZ filter can be used to smooth the periodogram. For a class of stochastic processes, Zurbenko considered the worst-case scenario where the only information available about a process is its spectral density and smoothness quantified by Hölder condition. He derived the optimal bandwidth of the spectral window, which is dependent upon the underlying smoothness of the spectral density. Zurbenko compared the performance of Kolmogorov–Zurbenko (KZ) window to the other typically  used spectral windows including Bartlett window, Parzen window, Tukey–Hamming window and uniform window and showed that the result from KZ window is closest to optimum. Developed as an abstract discrete construction, KZ filtration is robust and statistically nearly optimal. At the same time, because of its natural form, it has computational advantages, permitting analysis of space/time problems with data that has much as 90% of observations missing, and which represent a messy combination of several different physical phenomena. Clear answers can often be found for "unsolvable" problems. Unlike some mathematical developments, KZ is adaptable by specialists in different  areas because it has a clear physical interpretation behind it. Extensions. Extensions of KZ filter include KZ adaptive (KZA) filter, spatial KZ filter and KZ Fourier transform (KZFT). Yang and Zurbenko provided a detailed review of KZ filter and its extensions. R packages are also available to implement KZ filtration KZFT KZFT filter is design for a reconstruction of periodic signals or seasonality covered by heavy noise. Seasonality is one of the key forms of nonstationarity that is often seen in time series. It is usually defined as the periodic components within the time series. Spectral analysis is a powerful  tool to analyze time series with seasonality. If a process is stationary, its spectrum is a continuous form as well. It can be treated parametrically for simplicity of prediction. If a spectrum contains lines, it indicates that the process is not stationary and contains periodicities. In this situation, parametric fitting generally results in seasonal residuals with reduced energies. This is due to the season to season variations. To avoid this problem, nonparametric approaches including band pass filters are recommended. Kolmogorov–Zurbenko Fourier Transform (KZFT) is one of such filters. The purpose of many applications is to reconstruct high resolution wavelet  from the noisy environment. It was proven that KZFT provides the best possible resolution in spectral domain. It permits the separation of two signals on the edge of a theoretically smallest distance, or reconstruct periodic signals covered by heavy noise and irregularly observed in time. Because of this, KZFT provides a unique opportunity for various applications. A computer algorithm to implement the KZFT has been provided in the R software. The KZFT is essentially a band pass filter that belongs to the category of short-time Fourier transform (STFT) with a unique time window. KZFT readily uncovers small deviations from  a constant spectral density of white noise resulting from computer random numbers generator. Such computer random number generations become predictable in the long run. Kolmogorov complexity provides the opportunity to generate unpredictable sequences of random numbers. Formally, we have a process , the KZFT filter with parameters "m" and "k", computed at frequency "ν", produces an output process, which is defined as following: where is defined as: , ..., and the polynomial coefficients is given by . Apparently filter is equivalent to the application of filter to the process . Similarly, the KZFT filter can be obtained through iterations in the same way as KZ  filter. The average of the square of KZFT in time over "S" periods of will provide an estimate of the square amplitude of the wave at frequency "ν" or KZ periodogram (KZP) based on 2"Sρ" observations around moment "t": Transfer function of KZFT is provided in Figure 2 has a very sharp frequency resolution with bandwidth limited by . For a complex-valued process , the outcome is unchanged. For a real-valued process, it distributes energy evenly over the real and complex domains. In other words, reconstructs a cosine or sine wave at the same frequency ν. It follows that correctly  reconstructs the amplitude and phase of an unknown wave with frequency ν. Figure below is providing power transfer function of KZFT filtration. It clearly display that it perfectly captured frequency of interest ν = 0.4 and provide practically no spectral leakage from a side lobes which control by parameter "k" of filtration. For practical purposes choice of "k" within range 3–5 is usually sufficient, when regular FFT ("k" = 1) is providing strong leakage of about 5%. Example: Simulated signal KZFT reconstruction of original signal embedded in the high noise of longitudinal observations ( missing rate 60%.) The KZFT filter in  the KZA package of R-software has a parameter "f" = frequency. By defining this parameter for each of the known dominant frequencies found in the spectrum, KZFT filter with parameters m=300 and k=3 to reconstruct the signal about each frequency (0.08 and 0.10 cycles per unit time). The reconstructed signal was determined by applying the KZFT filter twice (once about each dominant frequency) and then the summing the results of each filter. The correlation between the true signal and the reconstructed signal was 96.4%; displayed in figure 4. The original observations provide no guess of the complex, hidden periodicity , which was perfectly reconstructed by the algorithm. Raw data frequently contain hidden frequencies. Combinations of a few fixed frequency waves can complicate the recognition of the mixture of signals, but still remain predictable over time. Publications show that atmospheric pressure contains hidden periodicities resulting from the gravitational force of the moon and the daily period of the sun. The reconstruction of these periodic signals of atmospheric tidal waves allows for an explanation and prediction of many anomalies present in extreme weather. Similar tidal waves must exist on the sun resulting from the gravitational force of planets. The rotation of the  sun around its axes will cause a current, similar to the equatorial current on the earth. Perturbations or eddies around the current will cause anomalies on the surface of the sun. Horizontal rotational eddies in highly magnetic plasma will create a vertical explosion which will transport deeper, hotter plasma to above the surface of the sun. Each planet creates a tidal wave with a specific frequency on the sun. At times any two of the waves will occur in phase and other times will be out of phase. The resulting amplitude will oscillate with a difference frequency. The estimation of  the spectra of sunspot data using the DZ algorithm provides two sharp frequency lines with periodicities close to 9.9 and 11.7 years. These frequency lines can be considered as difference frequencies caused by Jupiter and Saturn (9.9) and Venus and Earth (11.7). The difference frequency between 9.9 and 11.7 yields a frequency with a 64-year period. All of these periods are identifiable in sunspot data. The 64-year period component is currently in a declining mode. This decline may cause a cooling effect on the earth in the near future. An examination of the joint effect of multiple planets  may reveal some long periods in sun activity and help explain climate fluctuations on earth. KZA Adaptive version of KZ filter, called KZ adaptive (KZA) filter, was developed for a search of breaks in nonparametric signals covered by heavy noise.. The KZA filter first identifies potential time intervals when a break occurs. It then examines these time intervals more carefully by reducing the window size so that the resolution of the smoothed outcome increases. As an example of break point detection, we simulate a long-term trend containing a break buried in seasonality and noise. Figure 2 is a plot  of a seasonal sine wave with amplitude of 1 unit, normally distributed noise (), and a base signal with a break. To make things more challenging, the base signal contains an overall downward trend of 1 unit and an upward break of 0.5 units. The downward trend and break are hardly visible in the original data. The base signal is a step function , with and with . The application of a low-pass smoothing filter to the original data results in an over smoothing of the break as shown in Figure 6. The position of the break is no longer obvious. The  application of an adaptive version of the KZ filter (KZA) finds the break as shown in Figure 5b. The construction of KZA is based on an adaptive version of the iterated smoothing filter KZ. The idea is to change the size of the filtering window based on the trends found with KZ. This will cause the filter to zoom in on the areas where the data is changing; the more rapid the change, the tighter the zoom will be. The first step in constructing KZA is to use KZ; where "k" is iterations and "q" is the filter length, where  is an iterated moving average where are the original data and are the filtered data. This result is used to build an adaptive version of the filter. The filter is composed of a head and tail ("q" and "q") respectively, with f = head and b = tail) that adjust in size in response to the data, effectively zooming in on regions where the data are changing rapidly. The head "q" shrinks in response to the break in the data. The difference vector built from KZ; is used to find the discrete equivalent of the derivative '. This result determines the  sizes of the head and the tail ("q" and "q" respectively) of the filtering window. If the slope is positive the head will shrink and the tail will expand to full size ('(, then and ) with . If the slope is negative the head of the window will be full sized while the tail will shrink (', then and . Detailed code of KZA is available. The KZA algorithm has all of the typical advantages of a nonparametric approach; it does not require any specific model of the time series under investigation. It searches for sudden changes over a low frequency signal of any  nature covered by heavy noise. KZA shows very high sensitivity for break detection, even with a very low signal-to-noise ratio; the accuracy of the detection of the time of the break is also very high. The KZA algorithm can be applied to restore noisy two-dimensional images. This could be a two-level function f(x,y) as a black-and-white picture damaged by strong noise, or a multilevel color picture. KZA can be applied line by line to detect the break (change of color), then the break points at different lines would be smoothed by the regular  KZ filter. Demonstration of spatial KZA is provided in Figure 7. Determinations of sharp frequency lines in the spectra can be determine by adaptively smoothed periodogram. The central idea of the algorithm is adaptively smoothing the logarithm of a KZ periodogram. The range of smoothing is provided by some fixed percentage of conditional entropy from total entropy. Roughly speaking, the algorithm operates uniformly on an information scale rather than a frequency scale. This algorithm is also known for parameter k=1 in KZP as Dirienzo-Zurbenko algorithm and provided in software. Spatial KZ filter Spatial KZ filter can be applied to  the variable recorded in time and space. Parameters of the filter can be chosen separately in time and space. Usually physical sense can be applied what scale of averaging is reasonable in space and what scale of averaging is reasonable in time. Parameter k is controlling sharpness of resolution of the filter or suppression of leak of frequencies. An algorithms for spatial KZ filter are available in R software. Outcome time parameter can be treated as virtual time, then images of results of filtration in space can be displayed as "movie" in virtual time. We may demonstrate application of 3D  spatial KZ filter applied to the world records of temperature "T"("t", "x", "y") as a function of time "t", longitude "x" and latitude "y". To select global climate fluctuations component parameters 25 month for time "t", 3° for longitude and latitude were chosen for KZ filtration. Parameter "k" were chosen equal 5 to accommodate resolutions of scales. Single slide of outcome "movie" is provided in Figure 8 below. Standard average cosine square temperature distribution low along latitudes were subtracted to identify fluctuations of climate in time and space. We can see anomalies of temperature fluctuations from cosine square law  over globe for 2007. Temperature anomalies are displayed over globe in the provided in figure scale on the right. It displays very high positive anomaly over Europe and North Africa, which were extending over last 100 years. Absolute humidity variable is keeping responsibility for major regional climate changings as it was displayed recently by Zurbenko Igor and Smith Devin in Kolmogorov–Zurbenko filters in spatiotemporal analysis. Those anomalies are slowly changing in time in the outcome "movie" of KZ filtration, slow intensification of observed anomalies were identified in time. Different scales fluctuations like El Niño scale and others are also  can be identified by spatial KZ filtration. High definition "movie" of those scales are provided in over North America. Different scales can be selected by KZ filtration for a different variable and corresponding multivariate analysis can provide high efficiency results for investigating outcome variable over other covariates. KZ filter resolution performs exceptionally well compare to conventional methods and in fact is computationally optimal.