# Analysis of Stock Market Indices with Multidimensional Scaling and Wavelets

Authors: J. Tenreiro Machado; Fernando B. Duarte; Gonçalo Monteiro Duarte
Journal: Mathematical Problems in Engineering
 (2012)

---

## Abstract

Stock market indices (SMIs) are important measures of financial and economical performance. Considerable research
efforts during the last years demonstrated that these signals have a chaotic nature and require sophisticated mathematical
tools for analyzing their characteristics. Classical methods, such as the Fourier transform, reveal considerable
limitations in discriminating different periods of time. This paper studies the dynamics of SMI by combining the
wavelet transform and the multidimensional scaling (MDS). Six continuous wavelets are tested for analyzing the
information content of the stock signals. In a first phase, the real Shannon wavelet is adopted for performing the evaluation
of the SMI dynamics, while their comparison is visualized by means of the MDS. In a second phase, the other
wavelets are also tested, and the corresponding MDS plots are analyzed.


---

## Body

## 1. Introduction

Economical indices measure segments of the stock market and are normally used to benchmark the performance of stock portfolios. This paper proposes a method for analyzing the correlations embedded in international stock markets. The study of the international stock markets may have different leitmotifs. Economic motivations to identify the main factors which affect the behavior of stock markets across different exchanges and countries. Statistical motivations to visualize correlations in order to suggest some potentially plausible parameter relations and restrictions. The understanding of such relations would be helpful to the design of good portfolios [1, 2].The financial time series are inherently noisy, nonstationary, and deterministic chaotic, that is to say the distribution of financial time series is changing over the time. The noise component is due to the unavailability of complete information from the signal behaviour to capture the dependency between past and future values.The complexity of the problem motivated the adoption of the wavelets for the study of the stock market indices (SMIs) [3, 4]. A wave is usually defined as an oscillating function of time, such as sinusoid. Fourier analysis is wave analysis. It expands signals in terms of sinusoids (or, equivalently, complex exponentials) which has proven to be valuable in mathematics and engineering, especially for periodic, time-invariant, or stationary phenomena. A wavelet is a “small wave,” which has its energy concentrated in time to give a tool for the analysis of transient, nonstationary, or time-varying phenomena. The wavelet transform allow users to establish a compromise between precision in the frequency and time domains. Several types of continuous wavelets are tested and, based on the emerging patterns, the real Shannon wavelet is considered as the best one for the analysis. The wavelet charts depict complex patterns and, due to the large number of cases, a comparison index is performed. Based on the similarity measure, the multidimensional scaling (MDS) visualization tool is adopted. MDS is a data analysis technique for depicting the similarity or dissimilarity of data. MDS is used to represent (dis)similarity data between objects by a variety of distance models. The term similarity is used to indicate the degree of likeness between two objects, while dissimilarity indicates the degree of unlikeness. MDS represents a set of objects as points in a multidimensional space in such a way that the points corresponding to similar objects are located close together, while those corresponding to dissimilar objects are located far apart. The researcher then attempts to make sense of the derived object configuration by identifying meaningful regions and/or directions in the space [5–9].The remainder of this paper is organized as follows. Section2 introduces the financial indices, the fundamental concepts adopted in the study, and the methodology of analysis. Section 3 analyzes the market stocks indices using wavelets. Section 4 presents a MDS analyzes based on wavelets. Finally, Section 5 draws the main conclusions.


## 2. Financial Indices: Fourier and Wavelet Transforms

Our data consist of then daily close values of S=33 stock markets, listed in Table 1, from January 2, 2000 up to December 31, 2009, to be denoted by xi(t), where t=1,…,n represent time and i=1,…,S. These specific stock markets were chosen because they are considered to be representative of the reality. The inclusion of more indexes would lead to confusion and, therefore, become counterproductive.Table 1
Thirty-three stock markets.
i
Stock market index
Abbreviation
Country
1
Dutch Euronext Amsterdam
aex
The Netherlands
2
All Ordinaries equities market
aord
Australia
3
Index of the Vienna Bourse
atx
Austria
4
EURONEXT BEL-20
bfx
Belgium
5
Bombay Stock Exchange Index
bse
India
6
San Paulo (Brazil) Stock
bvsp
Brazil
7
Budapest Stock Exchange
bux
Hungary
8
Cotation Assisée en Continu
cac
France
9
Egypt CMA Index
ccsi
Egypt
10
Dow Jones Industrial
dji
USA
11
Deutscher Aktien Index
dax
Germany
12
Footsie
ftse
United Kingdom
13
Stock market index in Hong Kong
hsi
Hong Kong
14
Iberia Index
ibex
Spain
15
Jakarta Stock Exchange
jkse
Indonesia
16
Bursa Malaysia
klse
Malaysia
17
Stock Market index of South Korea
ks11
South Korea
18
Argentina Merval Index
ks11
Argentina
19
Oslo Børs All Share Index
oseax
Norway
20
Italian Bourse
mibtel
Italy
21
Bolsa Mexicana de Valores
mxx
Mexico
22
NASDAQ
ndx
USA
23
Tokyo Stock Exchange
nikkei
Japan
24
New York Stock Exchange
nya
USA
25
Stock exchange of Portugal
psi20
Portugal
26
Standard & Poor's
sp500
USA
27
Shanghai Stock Exchange
ssec
China
28
Swiss Market Index
ssmi
Switzerland
29
Straits Times Index
sti
Singapore
30
Tel Aviv 100 Index
ta100
Israel
31
Toronto Stock Exchange
tsx
Canada
32
Taiwan Stock Exchange
twii
Taiwan
33
South Africa Index
zadowd
South AfricaThe data is obtained from data provided by Yahoo Finance web site [10] and measures indices in local currencies.For example, Figure1 depicts the time evolution of daily closing prices of the six stock markets versus time (in years). The charts exhibit the well-known noisy and chaotic characteristics. Each signal xi(t) is complex and difficult to analyze in the time domain. Therefore, for highlighting the characteristics of xi(t) is required the application of adequate signal processing tools. In the sequel is analyzed the performance of the Fourier and wavelets transforms.Figure 1
Time series for the {bvsp, dax, dji, ndx, nikkei, sp500} indices from January 2000 up to December 2009.


### 2.1. Fourier Analysis

For each signal index, the corresponding Fourier transform (FT) is calculated, according to:(2.1)F{x(t)}=∫-∞+∞‍x(t)e-jΩtdt,j2=-1,
where ℱ is the Fourier operator, x(t) is the index value, t is time, and Ω is the angular frequency.Figure2 shows the |ℱ{xk(t)}|  versusΩ for the {bvsp,dax,dji,ndx,nikkei,sp500} indices. The charts for the other SMI are of the same type and are not represented. It is well known that this tool “dilutes” the signal time information leading only to a global representation. Therefore, since the signals may be not stationary, accessing limited periods of time is problematic.|
ℱ
{
x
k
(
t
)
}
|  versusΩ for the {bvsp,dax,dji,ndx,nikkei,sp500} indices.
(a)
(b)
(c)
(d)
(e)


### 2.2. Wavelet Analysis

The continuous wavelet transform [11–13] is defined as
(2.2)[Wψx(t)](a,b)=1a∫-∞+∞x(t)ψ*t-badt,a>0,
where the symbol * denotes the complex conjugate, the parameters (a,b) represent the dyadic dilation and the dyadic position, respectively, and ψ is a function called the mother wavelet. The mother wavelet is the source for generating daughter wavelets, which are simply the translated and scaled versions of the mother wavelet. Often the parameter a is interpreted qualitatively as the inverse of the frequency of the Fourier analysis. The wavelet transform is often compared with the Fourier transform, in which signals are represented as a sum of sinusoids. The main difference is that wavelets are localized in both time and frequency, whereas the standard Fourier transform is only localized in frequency. Wavelets give a better signal representation using multiresolution analysis, with balanced resolution at any time and frequency.Wavelet transforms are classified into discrete wavelet transforms (DW) and continuous wavelet transforms (CW). Note that both DW and CW are continuous-time (analog) transforms. They can be used to represent continuous-time (analog) signals. CW operates over every possible scale and translation whereas DW uses a specific subset of scale and translation values or representation grid [14–17].In this paper are investigated three real and three complex valued CWs, namely, the Haar, Ricker (also called Mexican hat), Shannon, Hermitian hat, Shannon complex, and Morlet wavelets, denoted by {HW, RW, SW, HHW, SCW, MW}, defined by the expressions:(2.3)Haar:ψ(t)={1,0≤t<12-1,12≤t≤10,otherwiseShannonreal:ψ(t)=1πt[sin(2πt)-sin(πt)]Ricker(Mexicanhat):ψ(t)=23σπ1/4(1-t2σ2)e-t2/2σ2Hermitianhat:ψ(t)=25π1/4(1-t2+jt)et2/2Shannoncomplex:ψ(t)=sin(πt)πte-j2πtMorlet:ψ(t)=cσπ-1/4e-t2/2(ejσt-e-1/2σ2),cσ=(1+e-σ2-2e-3/4σ2)-1/2.Tackling the financial data through wavelets leads to a considerable volume of information. Therefore, for condensing the results of the wavelet charts a similarity measurer between two plots is developed in the next section. This index allows the construction of a symmetrical correlation matrix R comparing all cases. Based on the matrix it is then possible to use visualization tools for establishing a graphical locus of the thirty-three stock markets.The multidimensional scaling (MDS) visualization tool assigns a point to each item in a multidimensional space and then arranges the the “cloud” of points in a low-dimensional space in order to reproduce the observed similarities.Bearing these ideas in mind, for the stock market analysis, in the next section, is adopted (i) the set of thirty-three SMI listed in Table1 (ii) the CWs for the signal analysis, (iii) the six continuous wavelets {HW, RW, SW, HHW, SCW, MW} defined in (2.3), (iv) the measure of similarity between wavelet charts using an appropriate index, and (v) the adoption of the visualization technique for obtaining a graphical output.


## 2.1. Fourier Analysis

For each signal index, the corresponding Fourier transform (FT) is calculated, according to:(2.1)F{x(t)}=∫-∞+∞‍x(t)e-jΩtdt,j2=-1,
where ℱ is the Fourier operator, x(t) is the index value, t is time, and Ω is the angular frequency.Figure2 shows the |ℱ{xk(t)}|  versusΩ for the {bvsp,dax,dji,ndx,nikkei,sp500} indices. The charts for the other SMI are of the same type and are not represented. It is well known that this tool “dilutes” the signal time information leading only to a global representation. Therefore, since the signals may be not stationary, accessing limited periods of time is problematic.|
ℱ
{
x
k
(
t
)
}
|  versusΩ for the {bvsp,dax,dji,ndx,nikkei,sp500} indices.
(a)
(b)
(c)
(d)
(e)


## 2.2. Wavelet Analysis

The continuous wavelet transform [11–13] is defined as
(2.2)[Wψx(t)](a,b)=1a∫-∞+∞x(t)ψ*t-badt,a>0,
where the symbol * denotes the complex conjugate, the parameters (a,b) represent the dyadic dilation and the dyadic position, respectively, and ψ is a function called the mother wavelet. The mother wavelet is the source for generating daughter wavelets, which are simply the translated and scaled versions of the mother wavelet. Often the parameter a is interpreted qualitatively as the inverse of the frequency of the Fourier analysis. The wavelet transform is often compared with the Fourier transform, in which signals are represented as a sum of sinusoids. The main difference is that wavelets are localized in both time and frequency, whereas the standard Fourier transform is only localized in frequency. Wavelets give a better signal representation using multiresolution analysis, with balanced resolution at any time and frequency.Wavelet transforms are classified into discrete wavelet transforms (DW) and continuous wavelet transforms (CW). Note that both DW and CW are continuous-time (analog) transforms. They can be used to represent continuous-time (analog) signals. CW operates over every possible scale and translation whereas DW uses a specific subset of scale and translation values or representation grid [14–17].In this paper are investigated three real and three complex valued CWs, namely, the Haar, Ricker (also called Mexican hat), Shannon, Hermitian hat, Shannon complex, and Morlet wavelets, denoted by {HW, RW, SW, HHW, SCW, MW}, defined by the expressions:(2.3)Haar:ψ(t)={1,0≤t<12-1,12≤t≤10,otherwiseShannonreal:ψ(t)=1πt[sin(2πt)-sin(πt)]Ricker(Mexicanhat):ψ(t)=23σπ1/4(1-t2σ2)e-t2/2σ2Hermitianhat:ψ(t)=25π1/4(1-t2+jt)et2/2Shannoncomplex:ψ(t)=sin(πt)πte-j2πtMorlet:ψ(t)=cσπ-1/4e-t2/2(ejσt-e-1/2σ2),cσ=(1+e-σ2-2e-3/4σ2)-1/2.Tackling the financial data through wavelets leads to a considerable volume of information. Therefore, for condensing the results of the wavelet charts a similarity measurer between two plots is developed in the next section. This index allows the construction of a symmetrical correlation matrix R comparing all cases. Based on the matrix it is then possible to use visualization tools for establishing a graphical locus of the thirty-three stock markets.The multidimensional scaling (MDS) visualization tool assigns a point to each item in a multidimensional space and then arranges the the “cloud” of points in a low-dimensional space in order to reproduce the observed similarities.Bearing these ideas in mind, for the stock market analysis, in the next section, is adopted (i) the set of thirty-three SMI listed in Table1 (ii) the CWs for the signal analysis, (iii) the six continuous wavelets {HW, RW, SW, HHW, SCW, MW} defined in (2.3), (iv) the measure of similarity between wavelet charts using an appropriate index, and (v) the adoption of the visualization technique for obtaining a graphical output.


## 3. Wavelet Analysis of the SMI

For each of the thirty three index signals,xi(t),i=1,…,S, the wavelet transform [Wψx(t)](a,b) is calculated. The results of the wavelet analysis depend on the mother function ψ to be adopted. Therefore, before comparing all indices, a preliminary evaluation is developed in order to characterize of each function ψ for the analysis of the indices signal. In this line of thought, Figure 3 depicts the absolute value of the wavelet for the dji index and the six functions listed in (2.3), where it is adopted that σ=1 and σ=5 for the RW and the MW, respectively. Furthermore, it is established a “time step” dt=1 for the sequence base increment along the index, and the parameters (a,b) are considered to vary from zero up to the maximum length of signal index. In the charts, we must take care with the results at the limits of the intervals of variation of the parameters (a,b) due to truncation effects.Absolute value of the six wavelets {HW, RW, SW, HHW, SCW, MW} listed in (2.3) versus(a,b) for the dji index, with dt=1.
(a)
(b)
(c)
(d)
(e)
(f)We verify that we get very different charts for each functionψ, that is, we conclude that the observation lens provided by ψ hide or reveal different signal characteristics and that some may be better adapted to this than others. The HW seems to be the “worst” probably because it is more adapted to digital signals, while in the present case we have a different type of time evolution. We observe that the RW has similarities to HHW, and, identically, the SCW to the MW. In these four cases, we observe a pattern for a in the middle of the interval and for low values of b. Particularly, the RW seems to present an slight higher level of detail with the presence of three objects. The SW seems to be a “good” wavelet, depicting a clear emergence of three objects. Other SMIs were tested leading to similar observations. Therefore, the SW is adopted for developing a first phase of exploratory analysis of the thirty three SMIs. Figure 4 depicts the absolute value of the SW of the {bvsp,dax,dji,ndx,nikkei,sp500} indices, where for the sake of completeness, dji is repeated.Absolute value of the SWversus(a,b) for the indices {bvsp,dax,dji,ndx,nikkei,sp500}, with dt=1.
(a)
(b)
(c)
(d)
(e)
(f)We verify that the charts are distinct from each other but reveal similarities namely, the emergence of several objects for low values ofb. While for most cases, we have three objects some charts present several levels according with b following a logic of different scales of resolution.


## 4. MDS Analysis Based on Wavelets

After calculating the wavelet transform, it is possible to compare visually the plots and to establish a qualitative grouping by similarities. Nevertheless, it is preferable to define a quantitative measure avoiding subjective assessments. It should be noted that wavelets results are complex-valued. Figure3 represents only the absolute value, but this approach is frequently adopted because it is simple and produces good results. In order to emphasize the shape of the wavelet plots, it was decided to normalize the charts, by converting the a and b axes into the interval [0,1] and by rescaling the wavelet absolute values so that the total volume becomes one. In other words, for each plot is considered for the x and y scale axes the values a/max(a) and b/max(b), for the z axis the values ||[Wψx(t)](a,b)||/∬(a,b)||[Wψx(t)](a,b)||dadb. Each plot can now be interpreted as a probability density function, and for comparing the normalized plots it is adopted the measure:
(4.1)rij=[(μa,i-μa,j)2+(σa,i-σa,j)2+(μb,i-μb,j)2+(σb,i-σb,j)2]1/2,i,j=1,…,33,
where the symbols μ and σ represent the arithmetic average and standard deviation, (a,b) are the wavelet parameters, and i,j are listed in the set of financial indices. Based on the rij index, it is now possible to calculate a R33×33 symmetric matrix of distances in the sense of (4.1) and to use a visualization tool for mapping the indices characteristics.In order to reveal possible relationships between the SMIs the MDS technique is used. In this perspective, several MDS criteria are tested. The Sammon criterion revealed good results and is adopted in this work [18, 19].


### 4.1. Using MDS and the SW

Figure5 depicts the two-(a) and three-(b) dimensional maps generated by the MDS [6, 8, 20–23].Two-(a) and three-(b) dimensional MDS map of the thirty-three indices.
(a)
(b)Usually the MDS output quality is evaluated by the Sheppard and stress diagrams. The first plots the distancesversus the original dissimilarities, and the second plots a measure of the mapping difficulty (called stress) versus the number of dimensions in the MDS representation. Obviously the closer to the 45-degree line, in the first case, or the lower the values, in the second case, the better is the MDS map. In this perspective, Figures 6 and 7 show the corresponding stress and Sheppard diagrams using SW, respectively, demonstrating a good fit of the two- and three-dimensional MDS maps [24].Figure 6
Stress valueversus number of plotting dimensions of the MDS map using SW.Shepard diagram of the 2D-MDS (a) and 3D-MDS (b) using SW.
(a)
(b)The aim of the MDS technique is to project the high-dimensional information into a low-dimensional space while preserving a good accuracy. Therefore, two-dimensional plots are sufficient, which will ease the comparison.


### 4.2. Using MDS and the HW, RW, HHW, SCW, and MW

We tested the SW for calculating the matrix of distances and plotting the MDS chart. The choice of the SW was merely based on a visual characteristics of the wavelet plots that revealed structured features. It is well known that the choice of a particular wavelet depends heavily on the application. In spite of the efforts that have been done in automating this choice, the fact is that often the best method is simply to experiment all wavelets. Having these ideas in mind, Figure8 shows the two-dimensional MDS plots for all wavelets (the SW MDS map is repeated for easing the comparison).Two-dimensional MDS map, of the thirty-three indices, with the six wavelets {HW, HHW, MW, RW, SCW, SRW} listed in (2.3).
(a)
(b)
(c)
(d)
(e)
(f)Comparing the six MDS plots, we verify that we get a distinct chart for each wavelet. This result is usual since MDS depends on the analysis index, which in our case corresponds to the type of wavelet (2.3) and the comparison measure (4.1). Furthermore, MDS plots must be interpreted only on the basis of clustering of points since they are insensitive to translations and rotations. Therefore, we observe that the MDS chart based on the HW has the most different features. Again, this result is common since it is known that the HW is more adapted to analyse digital signals. In what concerns the other five charts, the classification of the “best” one is more complicated since the clusters are not so different. Often MDS users prefer to have simple images, that is, with some clusters (that make sense for the application) but without an heavy overlapping of points. In this perspective, the SW is a good choice in the authors opinion, but SMI experts working in different areas may have distinct empirical choices. In fact, the adopting possibility of distinct measures based on the same methodology is one of the key features of the MDS scheme.Considering the SW, there are several empirical conclusions we can draw from the MDS graph (Figure8), and we will mention just a few here. We can clearly observe that there seem to emerge clusters, which show similar behavior [19]. Hence, there does not seem to be a single behavior market, but perhaps there are several important behaviors markets according their characteristics. We can say that {ndx,dax,psi20,aex,ssec,mibtel,cac}{atx,mxx,bux,zadowd,merv,bse,ccsi,bvsp,kse} form separate clusters while {ibex,ssmi,ftse,nikkei,twii,hsi,bfx,tsx,sti,nya,klse,sp500,sji} seem to form the “center cluster.” Furthermore, the indices such as {aord},{ks11},{oseax}, and {ta100} are separated from those groups.


## 4.1. Using MDS and the SW

Figure5 depicts the two-(a) and three-(b) dimensional maps generated by the MDS [6, 8, 20–23].Two-(a) and three-(b) dimensional MDS map of the thirty-three indices.
(a)
(b)Usually the MDS output quality is evaluated by the Sheppard and stress diagrams. The first plots the distancesversus the original dissimilarities, and the second plots a measure of the mapping difficulty (called stress) versus the number of dimensions in the MDS representation. Obviously the closer to the 45-degree line, in the first case, or the lower the values, in the second case, the better is the MDS map. In this perspective, Figures 6 and 7 show the corresponding stress and Sheppard diagrams using SW, respectively, demonstrating a good fit of the two- and three-dimensional MDS maps [24].Figure 6
Stress valueversus number of plotting dimensions of the MDS map using SW.Shepard diagram of the 2D-MDS (a) and 3D-MDS (b) using SW.
(a)
(b)The aim of the MDS technique is to project the high-dimensional information into a low-dimensional space while preserving a good accuracy. Therefore, two-dimensional plots are sufficient, which will ease the comparison.


## 4.2. Using MDS and the HW, RW, HHW, SCW, and MW

We tested the SW for calculating the matrix of distances and plotting the MDS chart. The choice of the SW was merely based on a visual characteristics of the wavelet plots that revealed structured features. It is well known that the choice of a particular wavelet depends heavily on the application. In spite of the efforts that have been done in automating this choice, the fact is that often the best method is simply to experiment all wavelets. Having these ideas in mind, Figure8 shows the two-dimensional MDS plots for all wavelets (the SW MDS map is repeated for easing the comparison).Two-dimensional MDS map, of the thirty-three indices, with the six wavelets {HW, HHW, MW, RW, SCW, SRW} listed in (2.3).
(a)
(b)
(c)
(d)
(e)
(f)Comparing the six MDS plots, we verify that we get a distinct chart for each wavelet. This result is usual since MDS depends on the analysis index, which in our case corresponds to the type of wavelet (2.3) and the comparison measure (4.1). Furthermore, MDS plots must be interpreted only on the basis of clustering of points since they are insensitive to translations and rotations. Therefore, we observe that the MDS chart based on the HW has the most different features. Again, this result is common since it is known that the HW is more adapted to analyse digital signals. In what concerns the other five charts, the classification of the “best” one is more complicated since the clusters are not so different. Often MDS users prefer to have simple images, that is, with some clusters (that make sense for the application) but without an heavy overlapping of points. In this perspective, the SW is a good choice in the authors opinion, but SMI experts working in different areas may have distinct empirical choices. In fact, the adopting possibility of distinct measures based on the same methodology is one of the key features of the MDS scheme.Considering the SW, there are several empirical conclusions we can draw from the MDS graph (Figure8), and we will mention just a few here. We can clearly observe that there seem to emerge clusters, which show similar behavior [19]. Hence, there does not seem to be a single behavior market, but perhaps there are several important behaviors markets according their characteristics. We can say that {ndx,dax,psi20,aex,ssec,mibtel,cac}{atx,mxx,bux,zadowd,merv,bse,ccsi,bvsp,kse} form separate clusters while {ibex,ssmi,ftse,nikkei,twii,hsi,bfx,tsx,sti,nya,klse,sp500,sji} seem to form the “center cluster.” Furthermore, the indices such as {aord},{ks11},{oseax}, and {ta100} are separated from those groups.


## 5. Conclusion

It seems that there are many distinct analogies between the dynamics of complex physical and financial systems.This information can be analyzed with tools usually adopted in dynamical systems and signal processing. In this paper was studied the evolution of financial indices by means of continuous wavelets. The application to the thirty-three SMI by means of six different wavelets revealed the dynamical characteristics. After comparing the distinct possibilities, the Shannon real wavelet was adopted for guiding the study. For comparing the results, an index inspired in probability theory was defined, and the MDS visualization technique was applied. The charts lead to the emergence of patterns and clusters capable of being interpreted and compared. Having established the processing methodology the analysis was repeated for the other wavelets, and the results were compared.



---

*Source: 819503-2012-07-01.xml*