Using Wavelets to Understand the Relationship between Mortgages and Gross Domestic Product in Spain

We use wavelet multiresolution decomposition and cross-wavelet analysis to reveal certain properties in financial data related to mortgages to households and gross domestic product data in Spain. Wavelet techniques possess many desirable properties, some of which are useful as a vehicle for analysing economic and financial data. In our case, wavelets are useful for drawing conclusions both in the time and frequency domains and for obtaining information on the different phases through which the study variables progress.


Introduction
The literature on wavelets has expanded rapidly over the past 20 years.Many papers have been published using wavelet methodology in a wide variety of disciplines.Applications using wavelets are prominent in astronomy, engineering, medicine, physics, and many other fields of study, including finance and economics in recent years, for instance, see 1-20 .
The goal of this paper is to illustrate for scenario testing the application of the wavelet technique, bearing the drawbacks in mind, in the multiresolution analysis for modelling financial data related to mortgages to households MH and gross domestic product GDP in order to obtain time and frequency information simultaneously.
The examples chosen reveal the importance of being able to decompose the original signal into a trend component and various detail components, which allow the different frequencies and their time model to be observed separately.

Multiresolution Decomposition
Next, we provide a brief theoretical overview that is available in more detail in 8 , among others.Our contribution focuses on the practical interpretation of the multiresolution decomposition MRD of a discrete signal for the financial data selected.
In general, the MRD of the variable or signal s t at the level N is given by {a a N is called the trend signal at level N and d n is the detail signal at level n constructed using the father or scaling function, representing the smooth, trend, or low-frequency and mother representing the detailed or high-frequency wavelets, respectively.In economics, s t is normally a discrete real time signal.Then, we can directly use a discrete wavelet transform DWT or the continuous wavelet transform CWT , if we assume a continuous signal x x t approximating s t , under certain conditions.
In general, given a particular wavelet ψ the CWT is a function of two variables W u, s and is obtained by projecting the function x via where ψ u,s t 1/ |s| ψ t − u /s is the translated via u and dilated via s version of the original wavelet ψ.The variables u and s represent, respectively, the position of the wavelet ψ in the time and frequency domains.This transform depicts the local variance of the time series x.
Taking into account the properties of the Fourier Transform, W x,ψ u, s may also be represented in the frequency domain, as where Ψ and X are the Fourier Transform of ψ and x, respectively, Ψ * symbolizes the complex conjugate of Ψ and i √ −1.Then, the wavelet power spectrum is defined as |W x u, s | 2 .Then, we may view the DWT as a discretization of the CWT through sampling specific wavelet coefficients.We can see that the Fourier transform is a particular case when ψ u,s t ψ t − u e −2πtui s 1 .The classical DWT is obtained from CWT using wavelets with s 2 −j and u k2 −j where j and k are integers dyadic basis representing the set of discrete translation and discrete dilations.The values for all integers j and k produce an orthogonal basis with a dyadic dilation.
In the wavelet transform, the scale, or dilation, operation is defined to preserve energy and the quality filter is the ratio of its peak energy to its bandwidth.
The interpretation of the MRD using the DWT and its inverse IDWT is of interest in terms of understanding the frequency at which activity in the time series occurs.
In our study, we will use MRD obtained with the Daubechies wavelets 5, 6 to improve on the frequency-domain characteristics of the Haar wavelets and which may still be interpreted as generalized differences of adjacent averages.We will use the discrete and continuous versions.

Cross-Wavelet Analysis: Transform, Power, Coherency, and Phase-Difference
The cross-wavelet analysis is used in many applications to analyse, detect and quantify relationships between two time series.The concepts of cross-wavelet power, wavelet coherency and wavelet phase-difference are natural generalizations of the basic wavelet analysis tools that enable us to appropriately deal with the time-frequency dependencies between two time series.Following the notation and definition in 2 , for specific values of the arguments u and s, the cross-wavelet transform of two series, x and y is defined as and the cross-wavelet power as |W xy |, which can be interpreted as the local covariance between these time series at each time and frequency.Note that when y x, we obtain the wavelet power spectrum.
If S denotes a smoothing operator in both time and scale, the complex wavelet coherency between x and y is defined by

3.2
Smoothing is necessary because otherwise, coherency would be identically one at all scales and times.Then, their module is called the wavelet coherency and their angle is called the phase-difference.On the one hand, a phase-difference of zero indicates that the time series move together at the specified time-frequency; a phase-difference located in the first quadrant indicates that the series move in phase, but the time series y leads x, while one located in the fourth quadrant indicates that x is leading.On the other hand, a phase-difference of π or -π indicates an anti-phase relationship, a phase-difference located in the second quadrant indicates that the series move out of phase, but the time series x leads y, while if located in the third quadrant it indicates that y is leading.
In this paper, we will use the Morlet wavelets to illustrate these concepts in our financial application.

Working with Financial Data
The data we will study are available from Spain's National Statistics Institute INE, http://www.ine.es/ and comprise the following series.
i Mortgages to households monthly data in Spain MHS and Santa Cruz de Tenerife, Canary Islands MHSCT .1995 M1-2010 M9.
ii Gross domestic product GDP quarterly data in Spain.Income current prices 1995Q1-2010Q3.
So as to take advantage of all the available data and be able to properly use the two series simultaneously, we arranged the data as follows.
i Since in 2003 the INE modified the methodology used to compile MHS and MHSCT data, we have two series for each case, 1995 M1-2003 M12 and 2003 M1-2010 M9, each of which relies on a different methodology.In order to use all of the available data while maintaining continuity in the time series data, we modified the 1995 M1-2002 M12 series by using a common statistical technique that relies on using a linking factor to account for the combination of the two series for each case.However, for these data series the INE does not specify the evaluated linking factor for the methodological change, only the methodology used.That is to say, said linking factor was calculated for each case as the ratio between the sum of the 2003 monthly data in the new series and the same one in the old series, resulting in a linking factor of 1.298853 for MHS and 1.126480 for MHSCT, respectively.
ii Since the available GDP data are quarterly, and so as to use them alongside the available MH monthly data without aggregating data, we interpolated the GDP series to yield a theoretical GDP monthly series.
The interpolation leads to a more suitable sample size to data series in keeping with 15 .Thus, we used two series containing 189 data points each.
The examples to be considered involve series of varying natures which exhibit a certain periodic behaviour.We use continuous wavelets to reveal the different cycles that are hidden within the data and to detect certain irregularities in the periodicity as well as onetime exchanges.The calculations and graphs of the MRD using Daubechies wavelets db3 are done on MATLAB with WAVELETS 1-D and those corresponding to the cross-wavelet analysis between time series on a modified MATLAB Toolbox of the so-called ASToolbox in 4 .The calculation using continuous wavelet analysis requires more computational time but yields graphs and results that are easier to interpret.
We will use two standard economic data types: first the percentage rates or INDEX as a ratio between two variables Section 4.1 , and growth rates as a measure of the evolution of a variable over time Section 4.2 .In Section 4.1, Fast Fourier Transform FFT and Daubechies discrete wavelets db3 are used for data modeling.Next, a sensitivity analysis is performed by testing four different assumptions regarding the short-term future, this time using continuous wavelets to facilitate a visual comparison between different models of these assumptions.
Since we will use the word index simultaneously in both a financial and mathematical context, we will write it in uppercase letters when referring to the economic variable growth rate or INDEX and in lowercase letters when referring to the mathematical variable frequency index .

Multiresolution Decomposition into INDEX Variables Using MH and GDP Monthly Data
In this section we illustrate the assumptions made and compare different cases using several figures.
Case 1. MRD to the Spain INDEX between MHS and GDP monthly data.
Figure 1 a shows the data for the INDEX MHS/GDP for Spain, as well as the approximations we obtained using the Daubechies discrete wavelet filter db3 at levels 2  1.
Next, using the Daubechies continuous wavelet filter db3 , we illustrate in Figure 2 the coefficients of the decomposition on different scales.Taking into account the information in 12 , we observe an increase in energy in the second part of the range that is independent of the typical boundary instability problems.
Keeping in mind the reliability limitations of any study on statistical predictions, we next conduct a sensitivity analysis using four assumptions and show the ability of MRD to highlight differences based on the assumptions.We then compare each assumption with known data from the 2010 M10.Note that Figures 3 to 7 below are identical to Figure 2 until 2010 M10.First assumption: We consider two different periods in the future.Current low credit levels are maintained during the first period Figure 3 a , and an effort is made in the second transition period to a higher stable level Figure 3 b .The most relevant frequency indices are indicated in Tables 2 and 3, respectively.
Second assumption: In the future, credit levels continue to be cut for some time.We observe in Figure 4 the new model.The most relevant frequency indices are equals to Table 2.
Third assumption: In the future, return to high credit levels through refinancing.Now, we observe in Figure 5 the new model.The most relevant frequency indices are equal to Table 2.
Fourth assumption: In the future, corrective measures are taken following the initial rise in Spain INDEX.The most relevant frequency indices are indicated in Table 4.
Note that the relevant index in d 2 , frequency index 65, is the same in every case, though significant differences are evident in the global model due to different assumptions at the end of the interval compare the coefficients at the different scales from 1 to 64 indicated on the vertical axis in Figures 3-6 .
In order to assess these assumptions, in Figure 7 we show the decomposition that is obtained for the aforementioned series until 2011M2, noting that the new data for the period  We now consider an analogous study with MHSCT, that is, using a similar INDEX for the Spanish province of Santa Cruz de Tenerife SCTfe INDEX MHSCT/GDP, over the period 1995 M1-2010M9 Figure 8 a .
Figure 8 b shows the details and the FFT of SCTfe INDEX.Note the significant differences with the general case for Spain.In particular, many more irregularities were detected at the provincial level than nationally compare Tables 1 and 5 .These differences suggest the convenience of showing the new SCTfe/Spain INDEX to compare both variables.Its decomposition is shown in Figure 9.
Furthermore, if we resort to continuous wavelets and study the coefficients of the decomposition, we obtain Figure 10, which shows an increase in the relative density starting in 2004.Table 6 includes the most relevant frequency indices.

Comparative Analysis. Quarterly Growth Rates of MHS and GDP
Next, we analyse two new financial variables: QG MHS and QG GDP, that is, quarterly growth rates of MHS and GDP obtained from monthly data series in order to compare our results with 18 relative to the German case.The data are shown in Figure 11.
Figures 12 and 13 show the percentage of energy for each wavelet coefficient using db3 and the wavelet power spectrum, respectively, which may be more informative.
The change in the dynamics of time series QG MHS and QG GDP is nearly impossible to spot in Figure 13 a .Furthermore, if we use traditional spectral analysis, the information on the dynamic response in the time domain is completely lost Figure 13 d     the same information as the global wavelet power spectrum, which is an average, over time, of the wavelet power spectrum.Figure 13 b show the wavelet power spectra themselves, an important advantage of wavelet analysis over spectral analysis.On the horizontal axis we have the time dimension.The vertical axis gives us the periods.The power is given by the colour.The colour code indicates ranges of power from blue low power to red high power .The white lines show the maxima of the undulations of the wavelet power spectrum, thus giving us an estimate of the cycle period.In the first case, the wavelet power spectrum of MHS varies considerably over time, especially after the year 2000.The maximum of the spectrum, indicated by white lines, has periodicities of around 4.5 and 7 years.We observe a white line on period seven across the entire horizontal axis, meaning that period seven has a permanent cycle, a cycle that intensified starting in the year 2000.For the GDP in the second case, the eight-year wavelet power spectrum shows also significant effects at higher frequencies after 2005.Comparing the power spectra of time series QG MHS and QG GDP might support similar conclusions as 19 for the German case, in the sense that there are differences in the relevant periodicities of MHS and GDP.
The wavelet cross spectrum Figure 14 and coherency Figure 15 provide waveletbased alternatives for the Fourier-based cross spectrum and coherency.These wavelet  estimators are suitable for non-stationary signals.Using a complex-valued analysing wavelet, we can also examine intervals in the time-scale plane where the two time series exhibit common phase behaviour.See, for example, 2 for more detail.Wavelet coherency can be interpreted as the local squared correlation coefficient in the time-scale plane.Figure 15 b shows the wavelet coherency time-period for easier interpretation.We observe two different coherency intervals between these two time series.The first time part exhibits strong coherence to large periods and low coherence for small periods.In the second time part there is a strong coherency for nearly all periods.small frequency bands.In the 1∼1.5 frequency band, the fact that the small cycles are in phase positively correlated is evidenced by the phase-difference, which is consistently situated between -π/2 and π/2.Finally, we can see in this band that the GDP cycle was leading from 1995 to 2007 and lagging from 2007, as evidenced by the positive phase difference in the first interval and the negative phase difference in the second.Looking at the 5∼6 frequency band, we note that the series are nearly out of phase around the year 2000 negatively correlated , with the GDP leading in every period.

Conclusions
In this paper, we have used wavelets to illustrate the relationship between MH and GDP in Spain and in one of its provinces, Santa Cruz de Tenerife.We believe the wavelet technique is appropriate for designing a credit policy based on GDP data at both the national and regional level.
Wavelets, like all spectral methods, can distinguish between different relationships that occur at the same time but at different frequencies.However, they are also suited to capturing structural breaks and transient stationary and non-stationary relationships.
In general, this tool is useful for all types of time-data comparisons when we are interested in drawing conclusions in both the time and frequency domains, as well as in obtaining information on the different phases through which the study variables progress.

2 b
Figure 1: a db3 filter of Spain INDEX, b detail series and FFT of Spain INDEX.
mode: init + by scale + abs C a,b coe a = 32 (frequency = 0.025) Coefficients line-C a,b for scale

Figure 3 :
Figure 3: a First assumption.Inclusion of the first period, b first assumption.Inclusion of the first and second periods.

Figure 7 :Figure 8 :
Figure 7: Comparison of data with theoretical assumptions.

Figure 11 :
Figure 11: Quarterly growth rates MHS and GDP.

Figure 12 :
Figure 12: Energy of coefficient db3 wavelet decomposition of MHS and GDP.

Figures 15 c
-15 d illustrate the phases and phase-difference computed for two different frequency bands 1∼1.5 frequency band in c and 5∼6 frequency band in d .The green and blue lines represent the GDP and MH phases, respectively.The red line represents the phase-difference.Note that the series are in phase, with the coherency being higher for

Figure 13 :
Figure 13: Wavelet Power Spectrum of quarterly change of MHS and GDP.

Figure 14 :
Figure 14: Wavelet cross spectrum between quarterly change of MHS and GDP.

Table 1 :
Relevant frequency indices of Spain INDEX.

Table 2 :
First assumption.Relevant frequency indices of Spain INDEX after first period added in the sensitivity analysis.

Table 3 :
First assumption.Relevant frequency indices of Spain INDEX after first and second periods added in the sensitivity analysis.

Table 4 :
Fourth assumption.Relevant frequency indices of Spain INDEX after data added in the sensitivity analysis.

Table 5 :
Relevant frequency indices of Spain INDEX and SCTfe INDEX.Comparison.

Table 6 :
Relevant frequency indices of SCTfe/Spain INDEX.