Nonlinear Alleviation of Edge Effects in the Context of Minimizing Prediction Errors

The aim of this article is to describe so-called “edge effects” in the context of wavelet analysis. The problem of “edge effects” is displayed in cases where the filter length is greater than 2. This is due to the fact that the calculation of the wavelet coefficients for the development of the last signal of finite elements, the filter should theoretically move beyond the signal. The article describes different ways to solve this problem using an authored approach. One of the ways presented in the article is an innovative approach in terms of “edge effects”. The author’s proposal is based on the nonlinear function of the trend after the division of the series into smaller units. The results obtained show that in comparison with other methods, the author’s method reduces errors. In this article, the Daubechies wavelet was used for the study. The Daubechies wavelets are a family of orthogonal wavelets, characterized by a maximum number of vanishing moments for a given support.


Introduction
Wavelet analysis is becoming more and more applicable every year.It is used, among others, to denoise, compress data, recognize features, detect system non-linearity and so on (Daubechies, 1992;Meyer, 1998;Mallat, 2008;Luisier, Blu, & Unser, 2007;Melgani & Bazi, 2008;Addison, 2017).Due to the growing application possibilities and the expanding base of the wavelet family, it is becoming an ever more important issue.
Waves are functions that oscillate over time, in space, or both.Wavelets are small waves of energy concentrated in a relatively short period of time.Wavelet analysis consists of decomposing the signal using wavelets obtained through translation and dilation of the mother wavelet.The wavelets are particularly useful for time-frequency analyzes of non-stationary series.
Wavelet transformation is a transformation similar to the Fourier transform.Both transformations are based on the use of the scalar product of the examined signals (t) and the remaining part, called the "nucleus of transformation." The main difference between these transformations is the nucleus (Istas & Lang, 1997;Kahane & Lemarié, 1995).
In the case of wavelet transformation, the kernel is a wavelet -a special function limited by certain requirements that must be met in order to be used for so-called multiresolution analysis (eg. it must have a scaling function).There are infinitely many such functions, so there are infinitely many wavelet transformations.
Wavelet transformation is suitable for the analysis of non-stationary signals because it provides time-frequency information.Often, it is used interchangeably with the Fourier transformation.The reason for this is that as a result of the wavelet transformation, we obtain information about the frequencies of only the individual spectral components of the signal with finite precision.This is because the transformation kernel (or function) does not represent an infinitely narrow frequency range, but a frequency range that is inversely proportional to the duration of the wavelet."The wavelet transform is calculated as shifting the wavelet function in time along the input signal and calculating the convolution of them.In most practical applications, the signals of interest have finite support.As the wavelet gets closer to the edge of the signal, computing the convolution requires non-existent values beyond the boundary.This creates boundary effects caused by incomplete information in the boundary regions.Thus, the results of wavelet transform in these boundary effects regions have questionable accuracy."(Su, Liu, & Li, 2012) See also (Queiroz, 1992;Cohen & Daubechies 1993).
Of course we can ignore inaccurate results at the edges, thus accepting the loss of data by cutting them down.However, this is a risky approach, because the data around the edges may contain relevant information.Therefore, a more favorable solution to the situation is to extend a series of data before processing it (Mallat, 2008;Strang & Nguyen, 1998;Jiménez & Prelcic, 2004).

Border Effect
The edge effect in spectral estimation is well known.It hampers interpretation of the spectral estimates, and poses problems for situations where, for example, low frequency signals are to be analyzed from relatively short time serie, or real-time applications where the parts of data that are close to the edges, in particular the newest observations, are critical.Classical numerical methods have been devised to detal with the edge effect, for example data windowing.While these methods are often effective, there are always trade-offs in the form of a certain loss of information.The way the edge effect appears in the time-frequency wavelet spectrum is as follows.If one plots the time-frequency wavelet spectrum with the horizontal axis indicating time and the vertical axis indicating frequency, then only the spectral values within a U-shaped domain are not affected by the edge effect (...)" (Zheng, Chao, Zhou, & Yu, 2000).For signal processing with wavelet transform, a pair of filters forming the so-called analysis filter bank is used.In the case of filters whose length is greater than two, there is the problem of edge effects.This problem results from the fact that for the calculation of the wavelet coefficients of the development wavelets for the latest elements of the finite signal, the filter should move beyond the signal.This is not possible.Therefore various methods of signal extension are proposed (see chapter 3).The filtering part of the reconstruction process is also subject to some discussion as it is the choice of filters that is crucial in achieving perfect reconstruction of the original signal.The downsampling of the signal components performed during the decomposition phase introduces a distortion called aliasing.It turns out that by carefully choosing filters for the decomposition and reconstruction phases, which are closely related (but not identical), we can "cancel out" the effects of aliasing.The low-and high-pass decomposition filters (L and H), together with their associated reconstruction filters (L' and H'), form a system of what is called quadrature mirror filters (see more in: Cohen, Daubechies, & Vial, 1993).

Extending of the Time Series
Various methods of extending the finite series are given in the literature (Hadaś-Dyduch, 2016b;Ferretti, Rizzo, 2000;Cohen, Daubechies, & Jawerth, 1993;Strang & Nguyen, 1996).Each method has its advantages and disadvantages.The degree of emphasizing the advantages and disadvantages of the extension methods depends on many factors, one of them being the specificity of a research series.


Zero-padding -this method is used in the version of the DWT given in the previous sections and assumes that the signal is zero outside the original support.The disadvantage of zero-padding is that discontinuities are artificially created at the border.


Symmetrization -this method assumes that signals or images can be recovered outside their original support by symmetric boundary value replication.Symmetrization has the disadvantage of artificially creating discontinuities of the first derivative at the border, but this method works well in general for images.


Smooth padding of order 1 -this method assumes that signals or images can be recovered outside their original support by a simple first-order derivative extrapolation: padding using a linear extension fit to the first two and last two values.Smooth padding works well in general for smooth signals.


Smooth padding of order 0 -this method assumes that signals or images can be recovered outside their original support by a simple constant extrapolation.For a signal extension this is the repetition of the first value on the left and last value on the right.


Periodic-padding (1) -this method assumes that signals or images can be recovered outside their original support by periodic extension.


Periodic-padding (2) -if the signal length is odd, the signal is first extended by adding an extra-sample equal to the last value on the right.Then a minimal periodic extension is performed on each side.The same kind of rule exists for images (Matlab; https://ch.mathworks.com/help/wavelet/ug/dealing-with-border-distortion.html?searchHighlight=extensions%20 dwt&s_tid=doc_srchtitle).
In this article, as a method to mitigate the edge effect, the following approach is suggested: 1) Division of a series into sub-series.In the case of a series including seasonal variations, division of the main series according to seasonality is preferred.
2) Estimating the non-linear trend function of each sub-series.Choose a line with the best fit from among the estimated trend lines .
3) Selection of the dominant trend function among the estimated trend functions for the sub-series.
4) The general form of the new series.
5) Determination of the theoretical values based on the selected function.
6) Save the new series: i.
8) Estimation of the approximating function.9) In the case of a small sample there is no need to divide the sample into smaller units.In this case, the next stage is the designation of the trend line.

Empirical Research
Details of the procedure for the proposed method for alleviating edge effects will be presented as applied to a randomly chosen series, shown in Figure 1. 1) The series shown in Fig. 1 is not a very large sample.Thus, there is no need to divide the series into sub-series.
2) The best approximating function for the series shown in Fig. 1 is a polynomial fourth degree function (Fig. 2).3) New series:  (Cohen, Daubechies, & Vial, 1993;Daubechies, 1992;Hadaś-Dyduch 2014a, 2015a, 2015b, 2015c, 2016a;Hadaś-Dyduch & Hadaś, 2017)) from: where: Daubechies is a wavelet with a compact carrier.Changing the row of wavelets affects the change in coefficients describing it.From a practical point of view, it is not always the best solution to use higher order wavelets as the increase in the order implies that the system needs more calculations.Their most important feature is that the lower-and upper-pass filters have a finite length.Daubechies are available for every even filter length.The Haar wavelet is the simplest element of this family, it has the shortest filters, but it is discontinuous.As the length of the filters increases, the smoothness of the wavelets increases.7) Save the wavelet function -approximates, according to the formula:
Using the authored algorithm for other time series as shown in Fig. 5, 6, 7, we obtain results which confirm that the author's proposed method is correct (see Tab. 1, 2).In the research article, only the Daubechies wavelet was used.However, there are many families of orthogonal wavelet functions with different properties.The first is the family of Haar wavelets, historically the oldest since it was proposed as long ago as 1910 by the Hungarian mathematician Alfred Haar.An important advantage of this simplest wavelet system is the ease of demonstrating the idea of a discrete wavelet transform using it.The second of the selected wavelet families are the Daubechies wavelets (Daubechies, 1992;Hadaś-Dyduch, 2017;2017b).The further two families -also constructed by Daubechies - Battle-Lamair, Meyer, Morlet and Shannon.In practical applications, biorthogonal wavelets are also very popular.

Conclusion
The article presents an innovative approach in terms of "edge effects".The author's proposal is based on the nonlinear function of the trend after the division of series into smaller units.The results obtained show that in comparison with other methods the author's method reduces errors.
Further studies, may apply the proposed method for removing edge effects in wavelet analysis, for the analysis of the relationship between the different regions in the context of a multi-dimensional series, taking into account macroeconomic indicators and determining the best extension for related series.The study will use results from earlier studies, as well as some interesting methods used so far in other tests, for example (Akbalik & Tunay, 2016;Hadaś-Dyduch, 2014a, 2015b).

Figure 1 .
Figure 1.Data for analysis

Figure 2 .
Figure 2. Time series and polynomial trend function

Figure 3 .
Figure 3.Time series and wavelet function approximating

Figure 7 .
Figure 7. Series 5 and trend function are modifications of the basic family of Daubechies wavelets: the Coiflet family and the Symlet family.Other wavelets known in the literature are:

Table 2 .
Results approximation for the series 2, 3, 4, 5 with the extension of Method 1