## Comparison of all correlation values to reference of 0.5
res <- with(stockprice, tcor(x = SP500, y = FTSE100, t = DateID, h = 300, CI = TRUE))
ref <- 0.5
test_against_ref <- test_ref(res, r_ref = ref)
head(test_against_ref)
## Plot to illustrate the correspondance with confidence intervals
plot(res$r ~ res$t, type = "l", ylim = c(0, 1), col = NULL)
abline(v = test_against_ref$t[test_against_ref$p > 0.05], col = "lightgreen")
abline(v = test_against_ref$t[test_against_ref$p < 0.05], col = "red")
points(res$r ~ res$t, type = "l")
points(res$upr ~ res$t, type = "l", lty = 2)
points(res$lwr ~ res$t, type = "l", lty = 2)
abline(h = ref, col = "blue")
## Test correlation of 0 a specific time points (using index or dates)
test_ref(res, t = c(100, 150))
test_ref(res, t = c("2000-08-18", "2000-10-27"))
Run the code above in your browser using DataLab