Analysis of stock market indices through multidimensional scaling

16
This article was downloaded by: [University of Tennessee At Martin] On: 05 October 2014, At: 05:40 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK Journal of Statistical Computation and Simulation Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/gscs20 Analysis of stock market indices through multidimensional scaling M.A.A. Cox a a School of Psychology, Newcastle University, Ridley Building, Newcastle upon Tyne, NE1 7RU, UK Published online: 24 Apr 2012. To cite this article: M.A.A. Cox (2013) Analysis of stock market indices through multidimensional scaling, Journal of Statistical Computation and Simulation, 83:11, 2015-2029, DOI: 10.1080/00949655.2012.678361 To link to this article: http://dx.doi.org/10.1080/00949655.2012.678361 PLEASE SCROLL DOWN FOR ARTICLE Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) contained in the publications on our platform. However, Taylor & Francis, our agents, and our licensors make no representations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of the Content. Any opinions and views expressed in this publication are the opinions and views of the authors, and are not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon and should be independently verified with primary sources of information. Taylor and Francis shall not be liable for any losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoever or howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use of the Content. This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http://www.tandfonline.com/page/terms- and-conditions

Transcript of Analysis of stock market indices through multidimensional scaling

Page 1: Analysis of stock market indices through multidimensional scaling

This article was downloaded by: [University of Tennessee At Martin]On: 05 October 2014, At: 05:40Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954 Registeredoffice: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK

Journal of Statistical Computation andSimulationPublication details, including instructions for authors andsubscription information:http://www.tandfonline.com/loi/gscs20

Analysis of stock market indicesthrough multidimensional scalingM.A.A. Coxa

a School of Psychology, Newcastle University, Ridley Building,Newcastle upon Tyne, NE1 7RU, UKPublished online: 24 Apr 2012.

To cite this article: M.A.A. Cox (2013) Analysis of stock market indices through multidimensionalscaling, Journal of Statistical Computation and Simulation, 83:11, 2015-2029, DOI:10.1080/00949655.2012.678361

To link to this article: http://dx.doi.org/10.1080/00949655.2012.678361

PLEASE SCROLL DOWN FOR ARTICLE

Taylor & Francis makes every effort to ensure the accuracy of all the information (the“Content”) contained in the publications on our platform. However, Taylor & Francis,our agents, and our licensors make no representations or warranties whatsoever as tothe accuracy, completeness, or suitability for any purpose of the Content. Any opinionsand views expressed in this publication are the opinions and views of the authors,and are not the views of or endorsed by Taylor & Francis. The accuracy of the Contentshould not be relied upon and should be independently verified with primary sourcesof information. Taylor and Francis shall not be liable for any losses, actions, claims,proceedings, demands, costs, expenses, damages, and other liabilities whatsoever orhowsoever caused arising directly or indirectly in connection with, in relation to or arisingout of the use of the Content.

This article may be used for research, teaching, and private study purposes. Anysubstantial or systematic reproduction, redistribution, reselling, loan, sub-licensing,systematic supply, or distribution in any form to anyone is expressly forbidden. Terms &Conditions of access and use can be found at http://www.tandfonline.com/page/terms-and-conditions

Page 2: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation, 2013Vol. 83, No. 11, 2015–2029, http://dx.doi.org/10.1080/00949655.2012.678361

Analysis of stock market indices throughmultidimensional scaling

M.A.A. Cox*

School of Psychology, Newcastle University, Ridley Building, Newcastle upon Tyne, NE1 7RU, UK

(Received 26 January 2012; final version received 19 March 2012)

Two similarity measures are employed to compare historic stock market indices over time. The moretraditional Euclidean similarity is employed to provide a reference.As a comparison, dynamic time warpingis introduced as a similarity measure. Multidimensional scaling is employed to compare these dissimilaritieson 15 financial indices sampled daily over a 10-year period. In addition to investigating the whole period,1-year tranches are also considered. This analysis is compared to a recent study of Machado et al. [Analysisof stock market indices through multidimensional scaling, Commun. Nonlinear Sci. Numer. Simul. 16(12)(2011), pp. 4610–4618], who examined these same indices using correlation as a similarity measure. Itis suggested that this approach may be problematic. Doubt is also cast on the efficacy of the ‘histogram’similarity they also propose.

Keywords: dynamic time warping; multidimensional scaling; Procrustes analysis; time series

1. Introduction

This paper explores the data considered by Machado et al. [1]. (I am indebted to theseauthors who kindly made their raw data available to me.) The previous authors used cor-relation (Corr) as a measure of the similarity between two time series. For time series{xi : i = 1, . . . , n} and {yi : i = 1, . . . , n), the correlation is defined as Corr(x, y) = ∑n

i=1 xiyi −(1/n)

∑ni=1 xi

∑ni=1 yi/

√(∑n

i=1 x2i − (1/n)(

∑ni=1 xi)2)(

∑ni=1 y2

i − (1/n) (∑n

i=1 yi)2). This choiceof similarity has the major advantage that the measure lies in the range [−1, 1] and hencedoes not necessitate scaling the raw data. However, it is restricted to time series of equallength.

The alternative, adopted here, is to scale all series to lie in the range [0, 1]. Giving {x′i :

i = 1, . . . , n} and {y′i : i = 1, . . . , n), where x′

i = (xi − min(xj))/(max(xj) − min(xj)), employinga similar transform for y′

i. Other forms of scaling are also available. Of course, Corr(x, y) =Corr(x′, y′).

Using the correlation on international financial indices, we can simply compare original dataon the same day from around the world. For instance, if we have an observation on day 2, is itthe best comparator from another series day 1, 2 or 3 (putting it obliquely, is today really today,or yesterday or tomorrow!)? There may be regional seasonal affects inherent in the raw data.

*Email: [email protected], [email protected]

© 2013 Taylor & Francis

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 3: Analysis of stock market indices through multidimensional scaling

2016 M.A.A. Cox

For instance, public holidays occur on a variety of dates and will affect values. Also there areyear-by-year changes, for instance, Easter occurs on the first Sunday after the full moon followingthe northern hemisphere’s vernal equinox. There may also be time delay effects related to turningpoints in the series. Did the USA cause a drop in the UK or vice versa?

In this case, the data have been pre-processed to days on which all financial markets consid-ered were in operation. For example, 17 January 2000 (the birthday of Dr Martin Luther KingJr, although the actual birth date was 15 January. It is a US public holiday on the third Mon-day in January) is omitted. This censoring is essential when employing measures such as thecorrelation, but not when employing the following procedure. It is for this reason, plus the align-ment problems already discussed, that dynamic time warping (DTW) is employed to find a bestmatch between a pair of time series. This procedure (DTW) was first introduced by Bellman andKalaba [2].

2. Dynamic time warping

The DTW algorithm is designed to compare two sequences of points. A cost function is definedbetween any pair of observations, with one selected from each series. The cost function mostusually adopted is the square of the Euclidean distance between the observations. The total costof comparing the two sequences is then the sum of the cost for each pair of correspondingobservations defined by the warping of time. We wish to find the best warping that gives thelowest cost for comparing the two sequences of observations.

Since DTW assumes continuity and monotonicity of the time, the minimum cost can be com-puted recursively by computing the minimum cost between two sub-sequences starting at theorigin, then stepping forward in time, either on one sequence or the other or both and computingthe minimum cost between the new sequences by adding the cost of the newly matched points.We are only interested in the final cost, which is the value of the similarity between the two pointsequences.

More formally DTW is a dynamic programming method that allows an optimal match to befound between two given time series with arbitrary lengths. The series are warped nonlinearlyin the time dimension to determine a measure of their similarity, independent of any nonlinearvariations in the time dimension. For a useful review, see Al-Naymat et al. [3] in which some ofthe following introductory discussion is loosely based.

As a general approach, time series of different lengths are assumed. Here, the first seriesis denoted by {xi : i = 1, . . . , n}, it is indexed by i and of length n, the second time series is{yi : i = 1, . . . , m}, which is indexed by j and of length m. The procedure is a time series associationalgorithm; it relates two time series by warping the time axis of one series onto the other. It is adynamic programming technique. Thus, the problem is divided into a series of sub-problems, eachof which contributes to calculating the cumulative distance. By DTW(x1, . . . , xi, y1, . . . , yj), wedenote the minimum time warped cost between (x1, . . . , xi) and (y1, . . . , yj) written, for brevity,as DTW(i, j). The recursion scheme that governs the computation is DTW(i, j) = d(xi, yj) +min ·(DTW(i − 1, j), DTW(j, j − 1), DTW(i − 1, j − 1)), the new minimum cost is related to theminimum of those at a previous stage. Here, d(xi, yj) is the distance between the two observationsxi and yj. The aim is to find DTW(n, m), the total minimum cost. The algorithm is widely publishedand summarized in Figure 1.

For example, if x = (3, 6, 5, 5, 5, 8, 5, 0, 6, 8)n = 10 and y = (9, 0, 1, 8, 4, 0, 4, 8)m = 8, theresulting DTW values are given in Table 1. In this case, d(xi, yj) = (xi − yj)

2 was used, to providea natural comparison to the Euclidean similarity, which is employed below. An alternative wouldbe to utilize d(xi, yj) = |xi − yj|.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 4: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2017

∞=),i(DTW 0 i=1,…,n

∞=)j,(DTW 0 j=1,…,m

000 =),(DTW

))j,i(DTW),j,j(DTW),j,i(DTW.(min)y,x(d)j,i(DTW ji 1111 −−−−+= i=1,…,n j=1,…,m

Figure 1. The DTW algorithm.

Table 1. DTW evaluations for the example.

y

9 0 1 8 4 0 4 8

x 3 36 45 49 74 75 84 85 1106 45 72 70 53 57 93 88 895 61 70 86 62 54 79 80 895 77 86 86 71 55 79 80 895 93 102 102 80 56 80 80 898 91 155 151 80 72 120 96 805 106 116 132 89 73 97 97 890 171 106 107 153 89 73 89 1536 99 135 131 111 93 109 77 818 91 155 180 111 109 157 93 77

The selected options (that is the choice made when identifying the minimum in Figure 1) arein bold, and the reported DTW(10, 8) value is 77. The time warping employed is displayed inFigure 2. The full evaluation of the algorithm is presented in the appendix.

Machado et al. [1] employed multidimensional scaling (MDS) to analyse the similarities gener-ated for their data, their work should be referred to for an extensive review of the procedure. Havingobtained solutions, it is often necessary to compare one configuration of points in a Euclideanspace with another, where there is a one-to-one mapping between the points. For instance, whenpresenting multiple (matrix) plots of a series of solution configurations from a procedure such asMDS (as in the following figures). The technique of matching one configuration to another andproducing a measure of the match is called the Procrustes analysis. The Procrustes analysis seeksthe isotropic dilation and the rigid translation, reflection and rotation needed to best match oneconfiguration to the other. For further details, see Mardia et al. [4] and Sibson [5]. Here, since aseries of solutions are being compared (using different similarities or different years), it is usedto provide the closest alignment to the configuration displayed in the top left cell of a matrix plot.

3. Comparison of similarities

The data set was provided by Machado et al. [1]. Their first table summarizes the indices usedand the selected acronyms. The same notation is used here. The first cell of Figure 3 echoesthat previously presented (Corr) [1], while the other two employ Euclidean (Euc) distance [6],where Euc(x, y) = ∑n

i=(x′i − y′

i)2, and DTW which are successively adopted as the similarity

measure.While the panels of Figure 3 appear dissimilar, it is useful to actually measure any difference

by reporting the Procrustes statistics (Table 2).The statistics, which lie in the range [0, 1] support the visual comparison, the solutions differ

and the choice of similarity is important.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 5: Analysis of stock market indices through multidimensional scaling

2018 M.A.A. Cox

Figure 2. The time warping for the example.

Figure 3. A visual comparison of MDS solutions using correlation, Euclidean and DTW similarities.

4. Correlation similarity for 10-year periods

The original analysis of Machado et al. [1] is extended by partitioning the extensive data set intoannual elements. Initially correlation, as proposed by previous authors [1], is employed as thesimilarity measure, the results are displayed in Figure 4 and Table 3.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 6: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2019

Table 2. Procrustes comparison of MDSsolutions using correlation, Euclidean andDTW similarities.

Corr Euc DTW

Corr 0.00 0.27 0.59Euc 0.27 0.00 0.70DTW 0.59 0.70 0.00

Figure 4. MDS analysis using correlation similarity to compare the annual data.

Table 3. Procrustes statistics for correlation similarity to compare the annual data.

All 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

All 0.00 0.94 0.70 0.81 0.81 0.79 0.88 0.80 0.94 0.93 0.852000 0.94 0.00 0.96 0.88 0.88 0.78 0.87 0.89 0.82 0.89 0.832001 0.70 0.96 0.00 0.80 0.80 0.88 0.82 0.83 0.97 0.87 0.962002 0.81 0.88 0.80 0.00 0.00 0.72 0.36 0.82 0.92 0.87 0.982003 0.81 0.88 0.80 0.00 0.00 0.72 0.36 0.82 0.92 0.87 0.982004 0.79 0.78 0.88 0.72 0.72 0.00 0.58 0.77 0.92 0.91 0.912005 0.88 0.87 0.82 0.36 0.36 0.58 0.00 0.68 0.78 0.81 0.912006 0.80 0.89 0.83 0.82 0.82 0.77 0.68 0.00 0.76 0.41 0.772007 0.94 0.82 0.97 0.92 0.92 0.92 0.78 0.76 0.00 0.82 0.552008 0.93 0.89 0.87 0.87 0.87 0.91 0.81 0.41 0.82 0.00 0.512009 0.85 0.83 0.96 0.98 0.98 0.91 0.91 0.77 0.55 0.51 0.00

Clearly, there is a temporal development of the time series (as indicated by Figure 1 in [1]). Ofparticular interest is the convergence of the results for 2002 and 2003 with the exception of ssec(Shanghai Stock Exchange). It is hard to discern why this observation is unusual (see [1] Figure 1and Figure 10).

An alternate view of the same data is to follow the performance of the individual indices overthe 10 annual time periods. The results are displayed in Figure 5.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 7: Analysis of stock market indices through multidimensional scaling

2020 M.A.A. Cox

Figure 5. MDS analysis using correlation similarity to compare the development of the individual indices.

Of particular interest here is the sp500 (Standard and Poor’s 500), a basket of 500 US stocksthat are considered to be widely held. This holds a central position closely echoed by nya (NewYork Stock Exchange), just what happened in 2000 to differentiate this index from the sp500!

5. Euclidean similarity for 10-year periods

A similar approach is considered using Euclidean similarities (Figures 6 and 7, Table 4) and DTW(Figures 8 and 9, Table 5).

6. DTW similarity for 10-year periods

The results are interesting and differ from those observed when using the correlation as a similaritymeasure. For instance there is clear clustering with the Euclidean similarity (Figure 6) for 2006and 2007. In 2006, the ndx (NASDAQ which is a US index originally founded as the NationalAssociation of Securities Dealers Automated Quotations) and ssec form one cluster, where thesetwo are clearly separated, but not close together. Just why have ndx, sp500 and nya moved so farapart in 2006/2007 when they are all US based. For the DTW, the behaviour in 2006 (Figure 8)closely resembles that seen in Figure 6, the same indices being segregated. In 2007, it is only thendx, which moves marginally apart from the pack. In both cases, there were no discernable featureswhen examining the individual indices, in particular the sp500 seems to lose its central role.

Does consideration of the raw data illuminate the previous analysis?

7. Superficial examination of the raw data

The raw data (having employed the scaling adopted here) do indicate that in the years 2006 and2007 both the ndx and ssec are significantly below the other indices. No such extreme behaviouris seen in 2002 and 2003, as illustrated by a simple box plot (Figure 10).

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 8: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2021

Figure 6. MDS analysis using Euclidean similarity to compare the annual data.

Figure 7. MDS analysis using Euclidean similarity to compare the development of the individual indices.

As previously mentioned, the ssec differs from the majority of the other indices. It is the fourthindex from the right in the panels of Figure 10. It is usually one of the lowers indices, but no moreso than Bolsa Mexicana de Valores.

While it is hard to make a choice between the three similarities considered, by comparingwith the raw data its flexibility (in dealing with different length series) and also its theoreticalbackground, the DTW would appear to be the most appropriate.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 9: Analysis of stock market indices through multidimensional scaling

2022 M.A.A. Cox

Table 4. Procrustes statistics for Euclidean similarity to compare annual data.

All 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

All 0.00 0.41 0.38 0.40 0.58 0.48 0.46 0.59 0.55 0.75 0.842000 0.41 0.00 0.22 0.39 0.68 0.75 0.82 0.98 0.92 0.88 0.842001 0.38 0.22 0.00 0.10 0.48 0.59 0.68 0.91 0.91 0.99 0.852002 0.40 0.39 0.10 0.00 0.39 0.44 0.53 0.80 0.81 0.99 0.882003 0.58 0.68 0.48 0.39 0.00 0.12 0.47 0.86 0.88 0.98 0.942004 0.48 0.75 0.59 0.44 0.12 0.00 0.25 0.65 0.72 0.94 0.982005 0.46 0.82 0.68 0.53 0.47 0.25 0.00 0.31 0.49 0.88 0.992006 0.59 0.98 0.91 0.80 0.86 0.65 0.31 0.00 0.27 0.66 0.882007 0.55 0.92 0.91 0.81 0.88 0.72 0.49 0.27 0.00 0.55 0.902008 0.75 0.88 0.99 0.99 0.98 0.94 0.88 0.66 0.55 0.00 0.572009 0.84 0.84 0.85 0.88 0.94 0.98 0.99 0.88 0.90 0.57 0.00

Figure 8. MDS analysis using DTW similarity to compare the annual data.

An alternative similarity was also considered by Machado et al. [1].

8. Histogram distance similarity

The similarity employed was the so-called ‘histogram distance’ [1], which in its simplest form

is defined to be dxy =√

(μx − μy)2/(μ2x + μ2

y) + (σx − σy)2/(σ 2x + σ 2

y ) (with the conventional

notation for the mean μ and standard deviation σ ) for times series {x} and {y}. Some interest-ing data sets to assess the ‘histogram distance’ measure are those proposed by Anscombe [7](Figure 11).

All three have mean 7.50 and variance 4.12, so in this case the ‘histogram distance’ willvanish while the time series clearly differ! Hence, this measure is not recommended and notpursued.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 10: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2023

Figure 9. MDS analysis using DTW similarity to compare the development of the individual indices.

Table 5. Procrustes statistics for DTW similarity to compare the annual data.

All 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009

All 0.00 0.87 0.84 0.89 0.93 0.95 0.94 0.83 0.77 0.29 0.122000 0.87 0.00 0.30 0.45 0.62 0.78 0.75 0.95 1.00 0.84 0.862001 0.84 0.30 0.00 0.20 0.41 0.65 0.68 0.92 0.97 0.91 0.852002 0.89 0.45 0.20 0.00 0.36 0.56 0.70 0.89 0.91 0.94 0.912003 0.93 0.62 0.41 0.36 0.00 0.21 0.42 0.77 0.94 0.96 0.992004 0.95 0.78 0.65 0.56 0.21 0.00 0.27 0.59 0.88 0.98 1.002005 0.94 0.75 0.68 0.70 0.42 0.27 0.00 0.29 0.80 0.98 0.952006 0.83 0.95 0.92 0.89 0.77 0.59 0.29 0.00 0.54 0.90 0.812007 0.77 1.00 0.97 0.91 0.94 0.88 0.80 0.54 0.00 0.75 0.812008 0.29 0.84 0.91 0.94 0.96 0.98 0.98 0.90 0.75 0.00 0.372009 0.12 0.86 0.85 0.91 0.99 1.00 0.95 0.81 0.81 0.37 0.00

9. Conclusions

It has been suggested that time warping might be a critical issue for financial markets assumingat least a weak form of market efficiency. In finance, the efficient-market hypothesis asserts thatfinancial markets are ‘informationally efficient’. That is, one cannot consistently achieve returnsin excess of average market returns on a risk-adjusted basis, given the information available atthe time the investment is made. The weak form of the efficient-market hypothesis [8] claims thatprices on traded assets (e.g. stocks, bonds, or property) already reflect all past publicly availableinformation.

The efficient-market hypothesis precludes the possibility of forecasting in financial markets.More precisely, the markets are deemed to be so efficient that the best forecast of a price levelfor the subsequent period is precisely the current price. Certain anomalies to the efficient-marketpremise have been observed, such as calendar effects. Even so, forecasting techniques have beenlargely unable to outperform the random walk model, which corresponds to the behaviour of

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 11: Analysis of stock market indices through multidimensional scaling

2024 M.A.A. Cox

Figure 10. Boxplots of the raw data.

Figure 11. Data sets proposed by Anscombe [7].

prices under the efficient-market hypothesis [9]. However, this is not a problem here as no attemptat extrapolation is considered, the only goal being to interpret historical data.

It is clear that MDS can have a great part to play in the comparison of time series. It has beenshown here that the adoption of an appropriate measure of similarity is a key question. If pressedto make a choice, I feel that the DTW is the most appropriate, since it addresses a number of thespecific traits inherent in time series. If there is no doubt about the mapping between the series, xi

maps to yi, then the DTW is redundant and it reverts to Euclidean distance. In this case (xi → yi)

the correlation is effective, in particular it does not necessitate scaling the data. It should also berecalled that MDS is a non-metric method and only the order of the similarities is important nottheir precise values. So, for instance, adoption of a final square root when forming the similarity

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 12: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2025

is not relevant. It is hoped that more workers will couple DTW and MDS for comparing timeseries data in the future.

References

[1] J.T. Machado, F.B. Duarte, and G.M. Duarte, Analysis of stock market indices through multidimensional scaling,Commun. Nonlinear Sci. Numer. Simul. 16(12) (2011), pp. 4610–4618.

[2] R. Bellman and R. Kalaba, On adaptive control processes, IRE Trans. Automat. Control 4(2) (1959), pp. 1–9.[3] G. Al-Naymat, S. Chawla, and J. Taheri, SparseDTW: A Novel Approach to Speed up Dynamic Time Warping, The

2009 Australasian Data Mining, Vol. 101, ACM Digital Library, Melbourne, Australia, 2009, pp. 117–127.[4] K.V. Mardia, J.T. Kent, and J.M. Bibby, Multivariate Analysis, Academic Press, London, 1979.[5] R. Sibson, Studies in the robustness of multidimensional Procrustes statistics, J. R. Stat. Soc. Ser. B. 40 (1979),

pp. 234–238.[6] T.F. Cox and M.A.A. Cox, Multidimensional Scaling, Chapman & Hall/CRC, Boca Raton, 2001.[7] F.J. Anscombe, Graphs in statistical analysis, Amer. Statist. 27 (1973), pp. 17–21.[8] F. Fabozzi and F. Modigliani, Capital Markets: Institutions and Instruments, Prentice Hall, Upper Saddle River, NJ,

1996.[9] S.H. Kim and S.H. Chun, Predictability through data mining as a test of the efficient market hypothesis,

23(1) (1998), pp. 433–482.

Appendix. Detailed evaluations for the DTW algorithm

For this example, the two time series are x = (3, 6, 5, 5, 5, 8, 5, 0, 6, 8) n = 10 and y = (9, 0, 1, 8, 4, 0, 4, 8) m = 8, withadopted distance d(xi, yj) = (xi − yj)

2. The four steps in the procedure (following Figure 1) are highlighted and the result-ing evaluations detailed. As a proxy, for ∞ the greatest achievable DTW value is employed, max(xi : i = 1, . . . , n, yj : j =1, . . . , m) × max(n, m) = 9 × 10 = 90 which is adopted. Obviously, any large enough value would suffice, for instancethe distinctive value 999.

Step 1 DTW(i, 0) = ∞ i = 1, . . . , nDTW(1,0) = 90DTW(2,0) = 90DTW(3,0) = 90DTW(4,0) = 90DTW(5,0) = 90DTW(6,0) = 90DTW(7,0) = 90DTW(8,0) = 90DTW(9,0) = 90DTW(10,0) = 90

Step 2 DTW(0, j) = ∞ j = 1, . . . , mDTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90DTW(0,0) = 90

Step 3 DTW(0, 0) = 0DTW(0,0) = 0

Step 4 DTW(i, j) = d(xi, yj) + min ·(DTW(i − 1, j), DTW(j, j − 1), DTW(i − 1, j − 1)) i = 1, . . . , n j = 1, . . . , m

DTW(1,1) = d(x(1),y(1)) + min(DTW(0,0),DTW(0,1),DTW(1,0))*DTW(1,1) = d(3,9) + min(0,90,90) = 36 + 0 = 36*

DTW(1,2) = d(x(1),y(2)) + min(DTW(0,1),DTW(0,2),DTW(1,1))*DTW(1,2) = d(3,0) + min(90,90,36) = 9 + 36 = 45*

DTW(1,3) = d(x(1),y(3)) + min(DTW(0,2),DTW(0,3),DTW(1,2))*DTW(1,3) = d(3,1) + min(90,90,45) = 4 + 45 = 49*

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 13: Analysis of stock market indices through multidimensional scaling

2026 M.A.A. Cox

DTW(1,4) = d(x(1),y(4)) + min(DTW(0,3),DTW(0,4),DTW(1,3))DTW(1,4) = d(3,8) + min(90,90,49) = 25 + 49 = 74

DTW(1,5) = d(x(1),y(5)) + min(DTW(0,4),DTW(0,5),DTW(1,4))DTW(1,5) = d(3,4) + min(90,90,74) = 1 + 74 = 75

DTW(1,6) = d(x(1),y(6)) + min(DTW(0,5),DTW(0,6),DTW(1,5))DTW(1,6) = d(3,0) + min(90,90,75) = 9 + 75 = 84

DTW(1,7) = d(x(1),y(7)) + min(DTW(0,6),DTW(0,7),DTW(1,6))DTW(1,7) = d(3,4) + min(90,90,84) = 1 + 84 = 85

DTW(1,8) = d(x(1),y(8)) + min(DTW(0,7),DTW(0,8),DTW(1,7))DTW(1,8) = d(3,8) + min(90,90,85) = 25 + 85 = 110

DTW(2,1) = d(x(2),y(1)) + min(DTW(1,0),DTW(1,1),DTW(2,0))DTW(2,1) = d(6,9) + min(90,36,90) = 9 + 36 = 45

DTW(2,2) = d(x(2),y(2)) + min(DTW(1,1),DTW(1,2),DTW(2,1))DTW(2,2) = d(6,0) + min(36,45,45) = 36 + 36 = 72

DTW(2,3) = d(x(2),y(3)) + min(DTW(1,2),DTW(1,3),DTW(2,2))DTW(2,3) = d(6,1) + min(45,49,72) = 25 + 45 = 70

DTW(2,4) = d(x(2),y(4)) + min(DTW(1,3),DTW(1,4),DTW(2,3))*DTW(2,4) = d(6,8) + min(49,74,70) = 4 + 49 = 53*

DTW(2,5) = d(x(2),y(5)) + min(DTW(1,4),DTW(1,5),DTW(2,4))DTW(2,5) = d(6,4) + min(74,75,53) = 4 + 53 = 57

DTW(2,6) = d(x(2),y(6)) + min(DTW(1,5),DTW(1,6),DTW(2,5))DTW(2,6) = d(6,0) + min(75,84,57) = 36 + 57 = 93

DTW(2,7) = d(x(2),y(7)) + min(DTW(1,6),DTW(1,7),DTW(2,6))DTW(2,7) = d(6,4) + min(84,85,93) = 4 + 84 = 88

DTW(2,8) = d(x(2),y(8)) + min(DTW(1,7),DTW(1,8),DTW(2,7))DTW(2,8) = d(6,8) + min(85,110,88) = 4 + 85 = 89

DTW(3,1) = d(x(3),y(1)) + min(DTW(2,0),DTW(2,1),DTW(3,0))DTW(3,1) = d(5,9) + min(90,45,90) = 16 + 45 = 61

DTW(3,2) = d(x(3),y(2)) + min(DTW(2,1),DTW(2,2),DTW(3,1))DTW(3,2) = d(5,0) + min(45,72,61) = 25 + 45 = 70

DTW(3,3) = d(x(3),y(3)) + min(DTW(2,2),DTW(2,3),DTW(3,2))DTW(3,3) = d(5,1) + min(72,70,70) = 16 + 70 = 86

DTW(3,4) = d(x(3),y(4)) + min(DTW(2,3),DTW(2,4),DTW(3,3))DTW(3,4) = d(5,8) + min(70,53,86) = 9 + 53 = 62

DTW(3,5) = d(x(3),y(5)) + min(DTW(2,4),DTW(2,5),DTW(3,4))*DTW(3,5) = d(5,4) + min(53,57,62) = 1 + 53 = 54*

DTW(3,6) = d(x(3),y(6)) + min(DTW(2,5),DTW(2,6),DTW(3,5))DTW(3,6) = d(5,0) + min(57,93,54) = 25 + 54 = 79

DTW(3,7) = d(x(3),y(7)) + min(DTW(2,6),DTW(2,7),DTW(3,6))DTW(3,7) = d(5,4) + min(93,88,79) = 1 + 79 = 80

DTW(3,8) = d(x(3),y(8)) + min(DTW(2,7),DTW(2,8),DTW(3,7))DTW(3,8) = d(5,8) + min(88,89,80) = 9 + 80 = 89

DTW(4,1) = d(x(4),y(1)) + min(DTW(3,0),DTW(3,1),DTW(4,0))DTW(4,1) = d(5,9) + min(90,61,90) = 16 + 61 = 77

DTW(4,2) = d(x(4),y(2)) + min(DTW(3,1),DTW(3,2),DTW(4,1))DTW(4,2) = d(5,0) + min(61,70,77) = 25 + 61 = 86

DTW(4,3) = d(x(4),y(3)) + min(DTW(3,2),DTW(3,3),DTW(4,2))DTW(4,3) = d(5,1) + min(70,86,86) = 16 + 70 = 86

DTW(4,4) = d(x(4),y(4)) + min(DTW(3,3),DTW(3,4),DTW(4,3))

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 14: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2027

DTW(4,4) = d(5,8) + min(86,62,86) = 9 + 62 = 71

DTW(4,5) = d(x(4),y(5)) + min(DTW(3,4),DTW(3,5),DTW(4,4))*DTW(4,5) = d(5,4) + min(62,54,71) = 1 + 54 = 55*

DTW(4,6) = d(x(4),y(6)) + min(DTW(3,5),DTW(3,6),DTW(4,5))DTW(4,6) = d(5,0) + min(54,79,55) = 25 + 54 = 79

DTW(4,7) = d(x(4),y(7)) + min(DTW(3,6),DTW(3,7),DTW(4,6))DTW(4,7) = d(5,4) + min(79,80,79) = 1 + 79 = 80

DTW(4,8) = d(x(4),y(8)) + min(DTW(3,7),DTW(3,8),DTW(4,7))DTW(4,8) = d(5,8) + min(80,89,80) = 9 + 80 = 89

DTW(5,1) = d(x(5),y(1)) + min(DTW(4,0),DTW(4,1),DTW(5,0))DTW(5,1) = d(5,9) + min(90,77,90) = 16 + 77 = 93

DTW(5,2) = d(x(5),y(2)) + min(DTW(4,1),DTW(4,2),DTW(5,1))DTW(5,2) = d(5,0) + min(77,86,93) = 25 + 77 = 102

DTW(5,3) = d(x(5),y(3)) + min(DTW(4,2),DTW(4,3),DTW(5,2))DTW(5,3) = d(5,1) + min(86,86,102) = 16 + 86 = 102

DTW(5,4) = d(x(5),y(4)) + min(DTW(4,3),DTW(4,4),DTW(5,3))DTW(5,4) = d(5,8) + min(86,71,102) = 9 + 71 = 80

DTW(5,5) = d(x(5),y(5)) + min(DTW(4,4),DTW(4,5),DTW(5,4))*DTW(5,5) = d(5,4) + min(71,55,80) = 1 + 55 = 56*

DTW(5,6) = d(x(5),y(6)) + min(DTW(4,5),DTW(4,6),DTW(5,5))DTW(5,6) = d(5,0) + min(55,79,56) = 25 + 55 = 80

DTW(5,7) = d(x(5),y(7)) + min(DTW(4,6),DTW(4,7),DTW(5,6))DTW(5,7) = d(5,4) + min(79,80,80) = 1 + 79 = 80

DTW(5,8) = d(x(5),y(8)) + min(DTW(4,7),DTW(4,8),DTW(5,7))DTW(5,8) = d(5,8) + min(80,89,80) = 9 + 80 = 89

DTW(6,1) = d(x(6),y(1)) + min(DTW(5,0),DTW(5,1),DTW(6,0))DTW(6,1) = d(8,9) + min(90,93,90) = 1 + 90 = 91

DTW(6,2) = d(x(6),y(2)) + min(DTW(5,1),DTW(5,2),DTW(6,1))DTW(6,2) = d(8,0) + min(93,102,91) = 64 + 91 = 155

DTW(6,3) = d(x(6),y(3)) + min(DTW(5,2),DTW(5,3),DTW(6,2))DTW(6,3) = d(8,1) + min(102,102,155) = 49 + 102 = 151

DTW(6,4) = d(x(6),y(4)) + min(DTW(5,3),DTW(5,4),DTW(6,3))DTW(6,4) = d(8,8) + min(102,80,151) = 0 + 80 = 80

DTW(6,5) = d(x(6),y(5)) + min(DTW(5,4),DTW(5,5),DTW(6,4))*DTW(6,5) = d(8,4) + min(80,56,80) = 16 + 56 = 72*

DTW(6,6) = d(x(6),y(6)) + min(DTW(5,5),DTW(5,6),DTW(6,5))DTW(6,6) = d(8,0) + min(56,80,72) = 64 + 56 = 120

DTW(6,7) = d(x(6),y(7)) + min(DTW(5,6),DTW(5,7),DTW(6,6))DTW(6,7) = d(8,4) + min(80,80,120) = 16 + 80 = 96

DTW(6,8) = d(x(6),y(8)) + min(DTW(5,7),DTW(5,8),DTW(6,7))DTW(6,8) = d(8,8) + min(80,89,96) = 0 + 80 = 80

DTW(7,1) = d(x(7),y(1)) + min(DTW(6,0),DTW(6,1),DTW(7,0))DTW(7,1) = d(5,9) + min(90,91,90) = 16 + 90 = 106

DTW(7,2) = d(x(7),y(2)) + min(DTW(6,1),DTW(6,2),DTW(7,1))DTW(7,2) = d(5,0) + min(91,155,106) = 25 + 91 = 116

DTW(7,3) = d(x(7),y(3)) + min(DTW(6,2),DTW(6,3),DTW(7,2))DTW(7,3) = d(5,1) + min(155,151,116) = 16 + 116 = 132

DTW(7,4) = d(x(7),y(4)) + min(DTW(6,3),DTW(6,4),DTW(7,3))DTW(7,4) = d(5,8) + min(151,80,132) = 9 + 80 = 89

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 15: Analysis of stock market indices through multidimensional scaling

2028 M.A.A. Cox

DTW(7,5) = d(x(7),y(5)) + min(DTW(6,4),DTW(6,5),DTW(7,4))*DTW(7,5) = d(5,4) + min(80,72,89) = 1 + 72 = 73*

DTW(7,6) = d(x(7),y(6)) + min(DTW(6,5),DTW(6,6),DTW(7,5))DTW(7,6) = d(5,0) + min(72,120,73) = 25 + 72 = 97

DTW(7,7) = d(x(7),y(7)) + min(DTW(6,6),DTW(6,7),DTW(7,6))DTW(7,7) = d(5,4) + min(120,96,97) = 1 + 96 = 97

DTW(7,8) = d(x(7),y(8)) + min(DTW(6,7),DTW(6,8),DTW(7,7))DTW(7,8) = d(5,8) + min(96,80,97) = 9 + 80 = 89

DTW(8,1) = d(x(8),y(1)) + min(DTW(7,0),DTW(7,1),DTW(8,0))DTW(8,1) = d(0,9) + min(90,106,90) = 81 + 90 = 171

DTW(8,2) = d(x(8),y(2)) + min(DTW(7,1),DTW(7,2),DTW(8,1))DTW(8,2) = d(0,0) + min(106,116,171) = 0 + 106 = 106

DTW(8,3) = d(x(8),y(3)) + min(DTW(7,2),DTW(7,3),DTW(8,2))DTW(8,3) = d(0,1) + min(116,132,106) = 1 + 106 = 107

DTW(8,4) = d(x(8),y(4)) + min(DTW(7,3),DTW(7,4),DTW(8,3))DTW(8,4) = d(0,8) + min(132,89,107) = 64 + 89 = 153

DTW(8,5) = d(x(8),y(5)) + min(DTW(7,4),DTW(7,5),DTW(8,4))DTW(8,5) = d(0,4) + min(89,73,153) = 16 + 73 = 89

DTW(8,6) = d(x(8),y(6)) + min(DTW(7,5),DTW(7,6),DTW(8,5))*DTW(8,6) = d(0,0) + min(73,97,89) = 0 + 73 = 73*

DTW(8,7) = d(x(8),y(7)) + min(DTW(7,6),DTW(7,7),DTW(8,6))DTW(8,7) = d(0,4) + min(97,97,73) = 16 + 73 = 89

DTW(8,8) = d(x(8),y(8)) + min(DTW(7,7),DTW(7,8),DTW(8,7))DTW(8,8) = d(0,8) + min(97,89,89) = 64 + 89 = 153

DTW(9,1) = d(x(9),y(1)) + min(DTW(8,0),DTW(8,1),DTW(9,0))DTW(9,1) = d(6,9) + min(90,171,90) = 9 + 90 = 99

DTW(9,2) = d(x(9),y(2)) + min(DTW(8,1),DTW(8,2),DTW(9,1))DTW(9,2) = d(6,0) + min(171,106,99) = 36 + 99 = 135

DTW(9,3) = d(x(9),y(3)) + min(DTW(8,2),DTW(8,3),DTW(9,2))DTW(9,3) = d(6,1) + min(106,107,135) = 25 + 106 = 131

DTW(9,4) = d(x(9),y(4)) + min(DTW(8,3),DTW(8,4),DTW(9,3))DTW(9,4) = d(6,8) + min(107,153,131) = 4 + 107 = 111

DTW(9,5) = d(x(9),y(5)) + min(DTW(8,4),DTW(8,5),DTW(9,4))DTW(9,5) = d(6,4) + min(153,89,111) = 4 + 89 = 93

DTW(9,6) = d(x(9),y(6)) + min(DTW(8,5),DTW(8,6),DTW(9,5))DTW(9,6) = d(6,0) + min(89,73,93) = 36 + 73 = 109

DTW(9,7) = d(x(9),y(7)) + min(DTW(8,6),DTW(8,7),DTW(9,6))*DTW(9,7) = d(6,4) + min(73,89,109) = 4 + 73 = 77*

DTW(9,8) = d(x(9),y(8)) + min(DTW(8,7),DTW(8,8),DTW(9,7))DTW(9,8) = d(6,8) + min(89,153,77) = 4 + 77 = 81

DTW(10,1) = d(x(10),y(1)) + min(DTW(9,0),DTW(9,1),DTW(10,0))DTW(10,1) = d(8,9) + min(90,99,90) = 1 + 90 = 91

DTW(10,2) = d(x(10),y(2)) + min(DTW(9,1),DTW(9,2),DTW(10,1))DTW(10,2) = d(8,0) + min(99,135,91) = 64 + 91 = 155

DTW(10,3) = d(x(10),y(3)) + min(DTW(9,2),DTW(9,3),DTW(10,2))DTW(10,3) = d(8,1) + min(135,131,155) = 49 + 131 = 180

DTW(10,4) = d(x(10),y(4)) + min(DTW(9,3),DTW(9,4),DTW(10,3))DTW(10,4) = d(8,8) + min(131,111,180) = 0 + 111 = 111

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014

Page 16: Analysis of stock market indices through multidimensional scaling

Journal of Statistical Computation and Simulation 2029

DTW(10,5) = d(x(10),y(5)) + min(DTW(9,4),DTW(9,5),DTW(10,4))DTW(10,5) = d(8,4) + min(111,93,111) = 16 + 93 = 109

DTW(10,6) = d(x(10),y(6)) + min(DTW(9,5),DTW(9,6),DTW(10,5))DTW(10,6) = d(8,0) + min(93,109,109) = 64 + 93 = 157

DTW(10,7) = d(x(10),y(7)) + min(DTW(9,6),DTW(9,7),DTW(10,6))DTW(10,7) = d(8,4) + min(109,77,157) = 16 + 77 = 93

DTW(10,8) = d(x(10),y(8)) + min(DTW(9,7),DTW(9,8),DTW(10,7))8DTW(10,8) = d(8,8) + min(77,81,93) = 0 + 77 = 77*

The optimum value is 77 and the values employed to reach this point have been identified (*) in the above calculations.

Dow

nloa

ded

by [

Uni

vers

ity o

f T

enne

ssee

At M

artin

] at

05:

40 0

5 O

ctob

er 2

014