I have two data series containing 132 log-returns. One is for EURUSD, the other is for NZDUSD. The head()
function shows you how some of the data looks. The correlation coefficient between the two, as calculated by cor()
is $0.5178912$.
To get a better sense of the correlation coefficient I bootstrap it by running cor()
1000 times on different 132 long samples. I run this in a loop and update euro.nzd.corr
on every iteration. This is the R code I'm using:
head(euro)
[1] -0.001257862 -0.011637970 0.002428757 0.003602590 -0.003457319 -0.002012728
head(nzd)
[1] 0.008773255 -0.007744927 0.005498693 0.005642524 -0.000896363 0.003449576
cor(euro,nzd)
[1] 0.5178912
euro.nzd.corr <- numeric(1000)
for(i in 1:1000){
euro.nzd.corr[i] = cor(euro[sample(132,132,replace=TRUE)],nzd[sample(132,132,replace=TRUE)])
}
plot(density(euro.nzd.corr), lwd=3, col="steelblue")
Once I have the data, I plot the density chart, and get this:
Bootstrapped data has mean $\approx 0$ and mostly spreads between $-0.3$ and $0.3$. Where has the initial cor()
result of $0.5178912$ gone? What am I to make of this? That it is better to conclude the two variables are uncorrelated versus correlated with a coefficient of $\approx 0.52$? Have I made any coding mistakes, or is the applied methodology simply flawed?