Created
June 26, 2012 16:37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#do preliminary exploration of paper Why Trend is Not Your Friend | |
#http://www.frankfurt-school.de/clicnetclm/fileDownload.do?goid=000000311260AB4 | |
#by Peter Scholz and Ursula Walther | |
#load table 2:Descriptive statistics of 35 leading equity indices | |
table2 <- read.csv("https://raw.github.com/gist/2996948/31d22bf58aad9f8421f419d659da90c4b3e0bcf0/table2.csv") | |
#load table 21: Average excess return from timing in the 35 selected leading equity indices | |
table21 <- read.csv("https://raw.github.com/gist/2996948/8ee5c1d6680fc592c99a68027d2381701c66bb22/table21.csv") | |
#I included the source at the end of attribution, so let's get rid of that | |
table2 <- table2[1:(NROW(table2)-2),] | |
table21 <- table21[1:(NROW(table21)-2),] | |
require(ggplot2) | |
require(reshape2) | |
require(directlabels) | |
require(RColorBrewer) | |
#the authors identify low/negative drift (mean) and high serial autocorrelation | |
#as main parameters allowing dominance of simple moving average | |
table2.melt <- melt(table2) | |
#name columns for easy reference while charting | |
colnames(table2.melt) <- c("country","statistic","value") | |
direct.label(ggplot(aes(x=statistic,y=value,group=country,colour=country),data=table2.melt) + | |
geom_point() + facet_wrap(~statistic, scales="free",nrow=2) + | |
theme_bw()+ | |
opts(axis.title.x = theme_blank()) + | |
opts(axis.title.y = theme_blank()) + | |
opts(title="Statistics of 35 Indexes from Table 2"), | |
list("last.points",cex=0.5)) | |
#dotchart(x=table2.melt$value,labels=table2.melt$country,group=table2.melt$statistic,cex=0.5) | |
#do a simple plot of mean(drift) versus serial autocorrelation | |
#color based on sum of outperformance of moving average strategies | |
#long way around but I cannot figure out a quicker way | |
#get colors to use for heat map | |
brew <- brewer.pal(name="RdYlGn",n=6) | |
#get color ramp | |
cc.brew <- colorRampPalette(brew) | |
#apply color ramp | |
cc <- cc.brew(35) | |
#do colors based on level of outperformance but with gray so visible when labelling | |
cc.palette <- colorRampPalette(c(cc[1],"antiquewhite4",cc[length(cc)])) | |
cc.levpalette <- cc.palette(35) | |
cc.levels <- level.colors(x=apply(table21[,2:NCOL(table21)],MARGIN=1,sum), do.breaks(c(-1.5,1.5),35), | |
col.regions = cc.levpalette) | |
plot(table2[,2]~table2[,7],type="p",pch=19,bty="l",col=cc.levels, | |
ylab = "mean (drift)", | |
xlab = "autocorrelation ARMA(1)") | |
text(y=table2[,2], x=table2[,7],labels = table2[,1], adj=0, cex=0.65,col=cc.levels) | |
title(main="Analysis of Outperformance (color) by Mean and Autocorrelation",adj=0,cex.main=0.9, outer=TRUE,font=1,line=-2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Country | mean | stddev | skew | kurt | JB(p) | autocorr | estAR1 | autoret | autovol | |
---|---|---|---|---|---|---|---|---|---|---|
Argentina | 6.05E-04 | 0.0224 | -0.0577 | 7.74 | 0.001 | 0.0426 | 0.0975 | 0.8775 | 1.16E-05 | |
Australia | 1.44E-04 | 0.0103 | -0.6469 | 10.23 | 0.001 | -0.0332 | 0.0939 | 0.9021 | 6.96E-07 | |
Austria | 3.08E-04 | 0.01532 | -0.3286 | 11.43 | 0.001 | 0.0529 | 0.137 | 0.8476 | 3.56E-06 | |
Belgium | -7.85E-05 | 0.01366 | 0.043 | 9.58 | 0.001 | 0.0645 | 0.1478 | 0.8436 | 2.33E-06 | |
Brazil | 5.97E-04 | 0.01999 | -0.1052 | 6.74 | 0.001 | 0.0056 | 0.0671 | 0.906 | 9.74E-06 | |
Canada | 4.20E-05 | 0.01365 | -0.6975 | 12.1 | 0.001 | -0.0828 | 0.0692 | 0.9263 | 8.37E-07 | |
China | 8.20E-04 | 0.02232 | 0.0289 | 8.34 | 0.001 | 0.0746 | 0.0816 | 0.912 | 3.67E-06 | |
Europe | -2.50E-04 | 0.01618 | 0.0715 | 7.71 | 0.001 | -0.0549 | 0.1081 | 0.8861 | 2.16E-06 | |
France | -2.39E-04 | 0.01588 | 0.0945 | 8.33 | 0.001 | -0.0545 | 0.1023 | 0.8929 | 1.88E-06 | |
Germany | -5.82E-05 | 0.01672 | 0.0458 | 7.42 | 0.001 | -0.0393 | 0.0993 | 0.894 | 2.24E-06 | |
Greece | -4.64E-04 | 0.01777 | -0.0031 | 7.26 | 0.001 | 0.0879 | 0.0996 | 0.8951 | 2.77E-06 | |
Hong Kong | 1.18E-04 | 0.01675 | 0.0482 | 10.8 | 0.001 | -0.0233 | 0.0679 | 0.9274 | 1.35E-06 | |
Hungary | 3.72E-04 | 0.01694 | -0.0608 | 9.15 | 0.001 | 0.0678 | 0.0995 | 0.8767 | 6.40E-06 | |
India | 5.53E-04 | 0.01715 | -0.3047 | 10.75 | 0.001 | 0.08 | 0.1492 | 0.8269 | 8.42E-06 | |
Indonesia | 6.59E-04 | 0.0154 | -0.636 | 8.77 | 0.001 | 0.1251 | 0.1341 | 0.8046 | 1.47E-05 | |
Italy | -3.30E-04 | 0.01498 | 0.038 | 9.5 | 0.001 | -0.01 | 0.1101 | 0.886 | 1.62E-06 | |
Japan | -2.76E-04 | 0.01639 | -0.3009 | 9.11 | 0.001 | -0.0356 | 0.0943 | 0.8963 | 2.89E-06 | |
Mexico | 5.97E-04 | 0.01456 | 0.0355 | 7.3 | 0.001 | 0.1038 | 0.0769 | 0.9049 | 3.66E-06 | |
The Netherlands | -2.85E-04 | 0.01661 | -0.0356 | 8.72 | 0.001 | -0.0259 | 0.1146 | 0.8813 | 1.81E-06 | |
Pakistan | 6.36E-04 | 0.01573 | -0.2356 | 5.51 | 0.001 | 0.1007 | 0.17 | 0.7871 | 1.13E-05 | |
Peru | 9.03E-04 | 0.01497 | -0.3824 | 13.5 | 0.001 | 0.2064 | 0.241 | 0.735 | 6.99E-06 | |
The Phillipines | 2.81E-04 | 0.01444 | 0.5627 | 19.16 | 0.001 | 0.1195 | 0.1219 | 0.8106 | 1.52E-05 | |
Poland | 6.62E-05 | 0.01683 | -0.066 | 4.8 | 0.001 | 0.0463 | 0.05 | 0.9424 | 2.28E-06 | |
Russia | 7.52E-04 | 0.02407 | -0.4505 | 11.56 | 0.001 | 0.0933 | 0.1241 | 0.8511 | 1.37E-05 | |
Saudi Arabia | 4.62E-04 | 0.01745 | -0.9722 | 10.99 | 0.001 | 0.0477 | 0.1511 | 0.8489 | 2.86E-06 | |
Singapore | 1.23E-04 | 0.01332 | -0.1447 | 6.99 | 0.001 | 0.0146 | 0.1026 | 0.892 | 1.66E-06 | |
South Africa | 4.62E-04 | 0.01465 | -0.0542 | 6.15 | 0.001 | 0.0388 | 0.0912 | 0.8941 | 3.22E-06 | |
South Korea | 3.32E-04 | 0.0179 | -0.4825 | 7.35 | 0.001 | 0.0172 | 0.0752 | 0.918 | 2.73E-06 | |
Spain | -3.09E-05 | 0.01545 | 0.1533 | 9.39 | 0.001 | -0.0329 | 0.111 | 0.8839 | 2.12E-06 | |
Sweden | -9.24E-05 | 0.01681 | 0.136 | 6.14 | 0.001 | -0.0259 | 0.0861 | 0.9085 | 2.03E-06 | |
Switzerland | -7.66E-05 | 0.01323 | 0.0254 | 9.1 | 0.001 | 0.0084 | 0.1298 | 0.8585 | 2.34E-06 | |
Thailand | 2.80E-04 | 0.01514 | -0.708 | 12.29 | 0.001 | 0.0299 | 0.1053 | 0.7956 | 2.16E-05 | |
Turkey | 5.45E-04 | 0.0249 | -0.0271 | 9.43 | 0.001 | 0.0069 | 0.1062 | 0.8762 | 1.22E-05 | |
UK | -8.17E-05 | 0.0133 | -0.1267 | 9.63 | 0.001 | -0.0733 | 0.1148 | 0.8813 | 1.22E-06 | |
U.S.A. | -1.21E-04 | 0.01384 | -0.0985 | 11.03 | 0.001 | -0.1027 | 0.0765 | 0.9172 | 1.12E-06 | |
source: Table 2 http://www.frankfurt-school.de/clicnetclm/fileDownload.do?goid=000000311260AB4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Country | 5 | 10 | 20 | 38 | 50 | 100 | 200 | |
---|---|---|---|---|---|---|---|---|
Argentina | -0.1576 | -0.1591 | -0.1519 | -0.1447 | -0.1516 | -0.1587 | -0.153 | |
Australia | -0.0222 | -0.0195 | -0.0211 | -0.0206 | -0.0199 | -0.0198 | -0.0189 | |
Austria | -0.1075 | -0.0897 | -0.0824 | -0.0621 | -0.0665 | -0.0585 | -0.0563 | |
Belgium | -0.0309 | -0.0351 | -0.0357 | -0.0389 | -0.0321 | -0.0364 | -0.0316 | |
Brazil | -0.1468 | -0.1391 | -0.1335 | -0.128 | -0.121 | -0.1159 | -0.1055 | |
Canada | -0.0296 | -0.0291 | -0.0273 | -0.0334 | -0.031 | -0.0254 | -0.0256 | |
China | -0.2277 | -0.2004 | -0.2012 | -0.1608 | -0.1707 | -0.1627 | -0.1233 | |
Europe | 0.0215 | 0.0158 | 0.0184 | 0.0172 | 0.0163 | 0.0195 | 0.0297 | |
France | 0.0004 | 0.0112 | 0.0051 | 0.0162 | 0.0119 | 0.0116 | 0.0106 | |
Germany | -0.024 | -0.0296 | -0.0161 | -0.0269 | -0.0343 | -0.0298 | -0.0342 | |
Greece | -0.0034 | 0.0109 | 0.0088 | 0.0178 | 0.0121 | 0.0167 | 0.0136 | |
Hong Kong | -0.0431 | -0.0533 | -0.0483 | -0.056 | -0.0548 | -0.0508 | -0.0629 | |
Hungary | -0.1007 | -0.0875 | -0.0853 | -0.0805 | -0.0769 | -0.0709 | -0.0671 | |
India | -0.0938 | -0.0948 | -0.0967 | -0.095 | -0.087 | -0.0772 | -0.0585 | |
Indonesia | -0.0797 | -0.07 | -0.0658 | -0.0607 | -0.0558 | -0.0478 | -0.0348 | |
Italy | 0.0333 | 0.0336 | 0.038 | 0.0355 | 0.0394 | 0.0385 | 0.0431 | |
Japan | 0.0315 | 0.0322 | 0.0402 | 0.0443 | 0.0353 | 0.0471 | 0.0427 | |
Mexico | -0.0634 | -0.0664 | -0.0573 | -0.0469 | -0.0467 | -0.0438 | -0.0338 | |
The Netherlands | 0.0134 | 0.0147 | 0.0053 | 0.015 | 0.0013 | 0.003 | 0.0147 | |
Pakistan | -0.0695 | -0.0631 | -0.059 | -0.0555 | -0.0496 | -0.0441 | -0.036 | |
Peru | -0.1021 | -0.0942 | -0.0779 | -0.0654 | -0.0645 | -0.0505 | -0.0306 | |
The Phillipines | -0.0463 | -0.0441 | -0.0392 | -0.0405 | -0.04 | -0.0376 | -0.041 | |
Poland | -0.0631 | -0.0621 | -0.0649 | -0.0585 | -0.0632 | -0.0534 | -0.0572 | |
Russia | -0.2313 | -0.2127 | -0.2011 | -0.1821 | -0.1853 | -0.1471 | -0.1066 | |
Saudi Arabia | -0.1347 | -0.1312 | -0.1105 | -0.1027 | -0.0996 | -0.0806 | -0.045 | |
Singapore | -0.0265 | -0.0247 | -0.0251 | -0.0296 | -0.0284 | -0.0283 | -0.029 | |
South Africa | -0.0699 | -0.0687 | -0.0582 | -0.0584 | -0.0542 | -0.0603 | -0.0492 | |
South Korea | -0.0749 | -0.0814 | -0.0717 | -0.0717 | -0.0738 | -0.0606 | -0.0654 | |
Spain | -0.0255 | -0.0195 | -0.0243 | -0.0328 | -0.0227 | -0.0351 | -0.029 | |
Sweden | -0.0221 | -0.0354 | -0.0392 | -0.0251 | -0.0355 | -0.0303 | -0.0268 | |
Switzerland | 0.0057 | 0.004 | 0.0032 | 0.0081 | 0.0021 | 0.0053 | 0.0027 | |
Thailand | -0.0536 | -0.054 | -0.0475 | -0.0458 | -0.0417 | -0.0432 | -0.0381 | |
Turkey | -0.1969 | -0.199 | -0.206 | -0.2015 | -0.2054 | -0.1748 | -0.176 | |
UK | 0.0022 | 0.0045 | 0.0017 | 0.004 | 0.0046 | 0.0046 | -0.0009 | |
U.S.A. | 0.0078 | 0.007 | 0.0088 | 0.0023 | 0.005 | 0.0085 | 0.0037 | |
source: Table 21 http://www.frankfurt-school.de/clicnetclm/fileDownload.do?goid=000000311260AB4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment