Wavelet Analysis: Part I (Theoretical Background)
This is the first of two entries devoted to wavelets. Here, we summarize the most important theoretical principles underlying wavelet analysis. This entry should serve as a detailed background reference when using the new wavelet features released in EViews 12. In Part II we will apply these principles and demonstrate how they are used with the new EViews 12 wavelet engine.
Table of Contents
- Introduction to Wavelets
- Wavelet Transforms
- Practical Considerations
- Wavelet Thresholding
Introduction to Wavelets
What characterizes most economic time series are time-varying features such as non-stationarity, volatility, seasonality, and structural discontinuities. Wavelet analysis is a natural framework for analyzing these phenomena without imposing any simplifying assumptions such as stationarity. In particular, wavelet filters can decompose and reconstruct a time series (as well as its correlation structure) across timescales so that constituent elements at one scale are uncorrelated with those at another. This is clearly useful in isolating features which materialize only at certain timescales.
Wavelet analysis is also, in many respects, like Fourier spectral analysis. Both methods can represent a time series signal in a different space by re-expressing a signal as a linear combination of basis functions. In the context of Fourier analysis, these basis functions are sines and cosines. While these basis functions approximate global variation well, they are poorly adapted to capturing local variation, otherwise known as time-variation in time series analysis. To see this, observe that trigonometric basis functions are sinusoids of the form:
is the amplitude,
is the frequency (in cycles per unit time) or period
(in units of time), and
is the phase. Accordingly, if the time variable
is shifted and scaled to
, the associated sinusoid becomes:
Evidently, the amplitude
is invariant to shifts in location and scale. Furthermore, notice that if
, the frequency
increases, but time
decreases, and vice versa. Accordingly, frequency information is gained when time information is lost, and vice versa.
Ultimately, trigonometric functions are ideally adapted to stationary processes characterized by impulses which wane with time, but are otherwise poorly adapted to discontinuous, non-linear, and non-stationary processes whose impulses persist and evolve with time. To surmount this fixed time-frequency relationship, a new set of basis functions are needed.
In contrast to Fourier transforms, wavelet transforms rely on a reference basis function called the mother wavelet. The latter is stretched (scaled) and shifted across time to capture time-dependent features. Thus, the wavelet basis functions are localized both in scale and time. In this sense, the wavelet basis function scale is the analogue of frequency in Fourier transforms. The fact that the wavelet basis function is also shifted (translated) across time, implies that wavelet basis functions are similar in spirit to performing a Fourier transform on a moving and overlapping window of subsets of the entire time series signal.
In particular, the mother wavelet function
is any function satisfying:
In other words, wavelets are functions that have mean zero and unit energy. Here, the term energy originates from the signal processing literature and is formalized as
for some function
. In fact, the concept is interchangeable with the idea of variance for non-complex functions.
From the mother wavelet, the wavelet basis functions are now derived as:
is the location constant, whereas
is the scaling factor which corresponds to the notion of frequency in Fourier analysis. Observe further that the analogue of the amplitude
in Fourier analysis, here captured by the term
, is in fact a function of the scale
. Accordingly, wavelet basis functions will adapt to scale-dependent phenomena much better than their trigonometric counterparts.
Since wavelet basis functions are de facto location and scale transformations of a single function, they are also an ideal tool for multiresolution analysis (MRA) – the ability to analyze a signal at different frequencies with varying resolutions. In fact, MRA is in some sense the inverse of the wavelet transform. It can derive representations of the original time-series data, using only those features which are characteristic at a given timescale.
For instance, a highly noisy but persistent time series, can be decomposed into a portion which represents only the noise (features captured at high frequency), and a portion which represents only the persistent signal (features captured at low frequencies). Thus, moving along the time domain, MRA allows one to zoom to a desired level of detail such that high (low) frequencies yield good (poor) time resolutions and poor (good) frequency resolutions. Since economic time series often exhibit multiscale features, wavelet techniques can effectively decompose these series into constituent processes associated with different timescales.
In the context of continuous functions, the continuous wavelet transform (CWT) of a time series
is defined as:
Moreover, the inverse transformation to reconstruct the original process is given as:
See Percival and Walden (2000) for a detailed discussion.
Since continuous functions are rarely observed, the CWT is empirically rarely exploited and a discretized analogue known as the discrete wavelet transform (DWT) is used. In its most basic form, the series length,
, is assumed dyadic (a power of 2), and the DWT manifests as a collection of CWT slices at nodes
. In other words, the discrete wavelet basis functions assume the form:
Unlike the CWT which is highly redundant in both location and scale, the DWT can be designed as an orthonormal transformation. If the location discretization is restricted to the index
, at each scale
, half the available observations are lost in exchange for orthonormality. This is the classical DWT framework. Alternatively, if the location index is restricted to the full set of available observations with
, the discretized transform is no longer orthonormal, but does not suffer from observation loss. The latter framework is typically referred to as the maximal overlap discrete wavelet transform (MODWT), and sometimes as the non-decimated DWT. Since the DWT is formally characterized by wavelet filters, we devote some time to those next.
Discrete Wavelet Filters
Formally, the DWT is characterized via
— the wavelet (high pass) and scaling (low pass) filters of length
, respectively, for some
. Recall that the low and high pass filters are defined in the context of frequency response functions, otherwise known as transfer functions. The latter are Fourier transforms of impulse response functions. Since the impulse response function describes, in the time domain, the evolution (response) of a time series signal to a given stimulus (impulse), the transfer function describes, in the frequency domain, the response of a time series signal to a given impulse in the frequency domain. In this regard, when the magnitude of the transfer function, otherwise known as the gain function, is large at low frequencies and small at high frequencies, the filter associated with that transfer function is said to be a low-pass filter. Otherwise, when the gain function is small at low frequencies but high at high frequencies, the transfer function is associated with a high-pass filter.
Like traditional time series filters which are used to extract features (eg. trends, seasonalities, business cycles, noise, etc.), wavelets filters perform a similar role. They are designed to capture low and high frequencies, and have a particular length. This length governs how much of the original series information is used to extract low and high frequency phenomena. This is very similar to the role of the autoregressive (AR) order in traditional time series models where higher AR orders imply more historical observations influence the present.
The simplest and shortest wavelet filter is of length
and is called the Haar wavelet. Formally, it is characterized by its high-pass filter definition:
This is a sequence of rescaled rectangular functions and is therefore ideally suited to analyzing signals with sudden and discontinuous changes. In this regard, it is ideally suited for outlier detection. Unfortunately, this filter is typically too simple for most other applications.
To help mitigate the limitations of the Haar filter, Daubechies (1992) introduced a family of filters (known as daublets) of even length that are indexed by the polynomial degree they are able to capture — rather the number of vanishing moments. Thus, the Haar filter, which is of length 2, can only capture constants and linear functions. The Daubechies wavelet filter of length 4 can capture everything from a constant to a cubic function, and so on. Accordingly, higher filter lengths are associated with higher smoothness. Unlike the Haar filter which has a closed form solution in the time domain, the Daubechies family of wavelet filters have a closed form solution only in the frequency domain.
Unfortunately, Daubechies filters are typically not symmetric. If a more symmetric version of the daublet filters is required, then the class known as least asymmetric, or symmlets, is used. The latter define a family of wavelet filters which are as close to symmetric as possible.
Mallat’s Pyramid Algorithm
In practice, DWT coefficients are derived through the pyramid algorithm of Mallat (1989). In case of the classical DWT with
as the matrix of DWT coefficients. Here,
is a vector of wavelet coefficients of length
and is associated with changes on a scale of length
is a vector of scaling coefficients of length
and is associated with averages on a scale of length
now follows from
orthonormal matrix generating the DWT coefficients. The algorithm can now be formalized as follows.
iteration of the algorithm convolves an input signal with filters
respectively to derive the
level DWT matrix
. Explicitly, the convolution is formalized as:
. In particular, each iteration therefore convolves the scaling coefficients from the preceding iteration, namely
, with both the high and low pass filters, and the input signal in the first iteration is
. The entire algorithm continues until the
iteration although it can be stopped earlier.
In effect, at each scale, the DWT algorithm partitions the frequency spectrum into equal subsets — the low and high frequencies. At the first scale, low-frequency phenomena of the original signal
are captured by
, whereas high frequency phenomena are captured by
. At scale 2, the same procedure is performed not on the original time series signal, but on the low-frequency components
. This in turn generates
, which is in a sense those phenomena that would be captured in the first quarter of the frequency spectrum, as well as
— the high-frequency components at scale 2, or those phenomena that would be captured in the second quarter of the frequency range. This continues at finer and finer levels as we increase scale. In this regard, increasing scale can isolate increasingly more persistent (lower frequency) features of the original time-series signal, with the wavelet coefficients
capturing the remaining, cumulated, “noisy” features.
It’s important to note that both the DWT and the MODWT make use of circular filtering. When a filtering operation reaches the beginning or end of an input series, otherwise known as the boundaries, the filter treats the input time series as periodic with period
. In other words, we assume that
are useful surrogates for unobserved values
. Those wavelet coefficients which are affected are also known as boundary coefficients. Note that the number of boundary coefficients only depends on the filter length
and is independent of the input series length
. Furthermore, the number of boundary coefficients increases with filter length
. In particular, the formula for the number of boundary coefficients for the DWT and MODWT respectively, are given by:
Furthermore, both DWT and MODWT boundary coefficients will appear at the beginning of
. Refer to Percival and Walden (2000) for further details.
The orthonormality of the DWT generating matrix
has important implications. First,
, is an identity matrix of dimension
. More importantly,
. To see this, recall that
. The DWT is therefore an energy (variance) preserving transformation. Coupled with this preservation of energy is also the decomposition of energy on a scale by scale basis. The latter formalizes as:
quantifies the energy of
accounted for at scale
. This decomposition is known as the wavelet power spectrum (WPS) and is arguably the most insightful of the properties of the DWT.
The WPS bares resemblance to the spectral density function (SDF) used in Fourier analysis. Whereas the SDF decomposes the variance of an input series across frequencies, in wavelet analysis, the variance of an input series is decomposed across scales
. One of the advantages of the WPS over the SDF is that the latter requires an estimate of the input series mean, whereas the former does not. In particular, note that the total variance in
can be decomposed as:
is the contribution to
due to scale
and is estimated as:
is the energy of
divided by the number of observations. Unfortunately, this estimator is biased due to the presence of boundary coefficients. To derive an unbiased estimate, boundary coefficients should be dropped from consideration. Accordingly, an unbiased estimate of variance contributed at scale
is given by:
when wavelet coefficients are derived using the DWT, whereas
in case wavelet coefficients derive from the MODWT.
It is also possible to derive confidence intervals for the contribution to the overall variance at each scale. In particular, dealing with unbiased estimators
and a level of significance
, a confidence interval for
is given by:
is the integral of the squared spectral density function of wavelet coefficients
excluding any boundary coefficients. As shown in Percival and Walden (2000),
can be estimated as the sum of squared serial correlations among
excluding any boundary coefficients. In other words:
Unfortunately, as argued in Priestley (1981), there is no condition that prevents the lower bound of the confidence interval above from becoming negative. Accordingly, Percival and Walden (2000) suggest the approximation:
is known as the equivalent degrees of freedom (EDOF) and is formalized as:
The confidence interval of interest with coverage
can now be stated as:
quantile for the
Remaining is the issue of EDOF estimation. Two suggestions in Percival and Walden (2000):
The first estimate above relies on large sample theory and in practice requires a sample of at least
to yield a decent approximation. The second assumes that the SDF of the wavelet coefficients at scale
is a band-pass. See Percival and Walden (2000) for details.
Similar to Fourier, spline, and linear approximations, a principal feature of the DWT is the ability to approximate an input series as a function of wavelet basis functions. In wavelet theory this is known as multiresolution analysis (MRA) and refers to the approximation of an input series at each scale (and up to all scales)
To formalize matters, recall that
and partition the rows of
commensurate with the row partition of
. In other words, let
. Then, note that for any
dimensional vectors, respectively called the
level detail and
level smooth series. Furthermore, since the low-pass (high-pass) wavelet coefficients are associated with changes (averages) at scale
, the detail and smooth series are associated with changes and average at scale
, respectively, in the input series
The MRA is typically used to derive approximations for the original series using its lower and upper frequency components. Since upper frequency components are associated with transient features and are captured by the wavelet coefficients, the detail series will in fact extract those features of the original series which are typically associated with “noise”. Alternatively, since lower frequency components are associated with perpetual features and are captured by the scaling coefficients, the smooth series will in fact extract those features of the original series which are typically associated with the “signal”.
It’s worth noting that because wavelet filtering can result in boundary coefficients, the detail and smooth series will have observations affected by the same. The latter are given as:
The exposition above introduces basic theory underlying wavelet analysis. Nevertheless, there are several practical (empirical) considerations which should be addressed. We focus here on three in particular:
- Wavelet filter selection
- Handling boundary conditions
- Non-dyadic series length adjustments
Choice of Wavelet Filter
The type of wavelet filter is typically chosen to mimic the data to which it is applied. Shorter filters don’t approximate the ideal band pass filter well, but longer ones do. On the other hand, if the data derives from piecewise constant functions, the Haar wavelet or other shorter wavelets may be more appropriate. Alternatively, if the underlying data is smooth, longer filters may be more appropriate. In this regard, it’s important to note that longer filters expose more coefficients to boundary condition effects than shorter ones.
Accordingly, the rule of thumb strategy is to use the filter with the smallest length that gives reasonable results. Furthermore, since the MODWT is not orthogonal and its wavelet coefficients are correlated, wavelet filter choice is not as vital as in the case of the orthogonal DWT. Nevertheless, if alignment to time is important (i.e. zero phase filters), the least asymmetric family of filters may be a good choice.
Handling Boundary Conditions
As previously mentioned, wavelet filters exhibit boundary conditions due to circular recycling of observations. Although this may be an appropriate assumption for some series such as those naturally exhibiting cyclical effects, it is not appropriate in all circumstances. In this regard, another popular approach is to reflect the original series to generate a series of length
. In other words, wavelet filtering proceeds on observations
. In either case, any proper wavelet analysis ought, at the very least, quantify how many wavelet coefficients are affected by boundary conditions.
Adjusting Non-dyadic Length Time Series
Recall that the DWT requires an input series of dyadic length. Naturally, this condition is rarely satisfied in practice. In this regard, there are two broad strategies. Either shorten the input series to dyadic length at the expense of losing observations, or “pad” the input series with observations to achieve dyadic length. In the context of the latter strategy, although the choice of padding values is ultimately arbitrary, there are three popular choices, neither of which has proven superior:
- Pad with zeros
- Pad with mean
- Pad with median
A key objective in any empirical work is to discriminate noise from useful information. In this regard, suppose that the observed time series
is an unknown signal of interest obscured by the presence of unwanted noise
. Traditionally, signal discernment was typically achieved using discrete Fourier transforms. Naturally, this assumes that any signal is an infinite superposition of sinusoidal functions; a strong assumption in empirical econometrics where most data exhibits unit roots, jumps, kinks, and various other non-linearities.
The principle behind wavelet-based signal extraction, otherwise known as wavelet shrinkage, is to shrink any wavelet coefficients not exceeding some threshold to zero and then exploit the MRA to synthesize the signal of interest using the modified wavelet coefficients. In other words, only those wavelet coefficients associated with very pronounced spectra are retained with the additional benefit of deriving a very sparse wavelet matrix.
To formalize the idea, let
. Next, recall that the DWT can be represented as
. The idea now is to shrink any coefficients not surpassing a threshold to zero.
While there are several thresholding rules, by far, the two most popular are:
- Hard Tresholding Rule (“kill/keep” strategy), formalized as:
- Soft Thresholding Rule, formalized as:
is the threshold limit.
The threshold value
is key to wavelet shrinkage. In particular, optimal thresholding is achieved when
is the standard deviation of the noise process
. In this regard, several threshold strategies have emerged over the years.
- Universal Threshold, proposed in Donoho and Johnstone (1994), and formalized as:
is estimated using wavelet coefficients only at scale
, regardless of what scale is under consideration. When this threshold rule is coupled with soft thresholding, the combination is commonly referred to as VisuShrink.
- Adaptive Universal Threshold is identical to the universal threshold above, but estimates
using those wavelet coefficients associated with the scale under consideration. In other words:
is the variance of the wavelet coefficients at scale
- Minimax Estimation proposed in Donoho and Johnstone (1994), and is formalized as the solution to:
Unfortunately, a closed form solution is not available, although tabulated values exist. Furthermore, when this threshold is coupled with soft thresholding, the combination is commonly referred to as RiskShrink.
- Stein’s Unbiased Risk Estimate (SURE), formalized as the solution to:
is the mean of some variable of interest
. In the framework of wavelet coefficients,
would represent the standardized wavelet coefficients at a given scale.
Furthermore, while the optimal threshold
based on this rule depends on the thresholding rule used, the solution may not be unique and so the SURE threshold value is the minimum such
. In case of the soft thresholding rule, the solution was proposed in Donoho and Johnstone (1994). Alternatively, for the hard thresholding rule, the solution was proposed in Jansen (2010).
- False Discovery Rate (FDR), proposed in Abramovich and Benjamini (1995), determines the threshold value through a multiple hypotheses testing problem. The procedure is summarized in the following algorithm:
- For each
consider the hypothesis
and its associated two-sided
where as before,
is the variance of the wavelet coefficients at scale
is the standard Gaussian CDF.
- Sort the
in ascending order so that:
denotes the cardinality (number of elements) in
. For instance, when
are derived from a DWT, then
define the significance level of the hypothesis tests and let
denote the largest
. For this
, the quantity:
is the optimal threshold for wavelet coefficients at scale
- For each
For further details, Donoho, Johnstone, et. al. (1998), Gencay, Selcu, and Whitcher (2001), and Percival and Walden (2000).
Wavelet Coefficient Variance
Before summarizing the entire threshold procedure, there remains the issue of how to estimate the variance of the wavelet coefficients,
. If the assumption is that the observed data
is obscured by some noise process
, the usual estimator of variance will exhibit extreme sensitivity to noisy observations. Accordingly, let
denote the mean and median, respectively, of the wavelet coefficients
, and let
denote its cardinality (total number of coefficients at said scale). Then, several common estimators have been proposed in the literature:
- Mean Absolute Deviation formalized as:
- Median Absolute Deviation formalized as:
- Mean Median Absolute Deviation formalized as:
- Median (Gaussian) formalized as:
The previous sections were devoted to describing thresholding rules and optimal threshold values. Here the focus is on summarizing thresholding implementations.
Effectively all wavelet thresholding procedures follow the algorithm below:
- Compute a wavelet transformation of the original data up to some scale
. In other words, derive a partial wavelet transform and derive the wavelet and scaling coefficients
- Select an optimal threshold
from one of the methods discussed earlier.
- Threshold the coefficients at each scale
using the threshold value selected in 2 and some thresholding rule (hard or soft). This will generate a set of modified (thresholded) wavelet coefficients
. Observe that scaling coefficients
are not thresholded.
- Use MRA with the thresholded coefficients to reconstruct the signal (original data) as follows:
In this first entry of our series on wavelets, we provided a theoretical overview of the most important aspects in wavelet analysis. In Part II, we will see how to apply these concepts by using the new wavelet features released with EViews 12.
- Abramovich F and Benjamini Y (1995), “Thresholding of wavelet coefficients as multiple hypotheses testing procedure”, In Wavelets and Statistics. , pp. 5-14. Springer.
- Daubechies I (1992), “Ten lectures on wavelets, CBMS-NSF Conference Series in Applied Mathematics”, SIAM Ed. , pp. 122-122.
- Donoho DL and Johnstone IM (1994), “Ideal spatial adaptation by wavelet shrinkage”, biomeliika. Vol. 81(3), pp. 425-455. Oxford University Press.
- Donoho DL and Johnstone IM (1995), “Adapting to unknown smoothness via wavelet shrinkage”, Journal of the american statistical association. Vol. 90(432), pp. 1200-1224. Taylor & Francis Group.
- Donoho DL, Johnstone IM and others (1998), “Minimax estimation via wavelet shrinkage”, The annals of Statistics. Vol. 26(3), pp. 879-921. Institute of Mathematical Statistics.
- Gençay R, Selçuk F and Whitcher BJ (2001), “An inlioduction to wavelets and other filtering methods in finance and economics” Academic press.
- Jansen M (2010), “Minimum risk methods in the estimation of unknown sparsity”, Technical report.
- Mallat S (1989), “A theory for multiresolution signal decomposition: The wavelet representation”, Pattern Analysis and Machine Intelligence, IEEE liansactions on. Vol. 11(7), pp. 674-693.
- Percival D and Walden A (2000), “Wavelet methods for time series analysis” Vol. 4 Cambridge Univ Pr.
- Priestley MB (1981), “Speclial analysis and time series: probability and mathematical statistics” (04; QA280, P7.)