# NOT RUN {
## Based on data from Figure 7.8 in Gencay, Selcuk and Whitcher (2001)
## plus one random series.
library(wavemulcor)
data(exchange)
returns <- diff(log(as.matrix(exchange)))
returns <- ts(returns, start=1970, freq=12)
N <- dim(returns)[1]
wf <- "d4"
J <- trunc(log2(N))-3
demusd.modwt <- brick.wall(modwt(returns[,"DEM.USD"], wf, J), wf)
jpyusd.modwt <- brick.wall(modwt(returns[,"JPY.USD"], wf, J), wf)
rand.modwt <- brick.wall(modwt(rnorm(length(returns[,"DEM.USD"])), wf, J), wf)
xx <- list(demusd.modwt, jpyusd.modwt, rand.modwt)
Lst <- wave.multiple.correlation(xx, N = length(xx[[1]][[1]]))
returns.modwt.cor <- Lst$xy.mulcor[1:J,]
YmaxR <- Lst$YmaxR
exchange.names <- c("DEM.USD", "JPY.USD", "RAND")
##Producing plot
par(mfrow=c(1,1), las=0, mar=c(5,4,4,2)+.1)
matplot(2^(0:(J-1)), returns.modwt.cor[-(J+1),], type="b",
log="x", pch="*LU", xaxt="n", lty=1, col=c(1,4,4),
xlab="Wavelet Scale", ylab="Wavelet Multiple Correlation")
axis(side=1, at=2^(0:7))
abline(h=0)
text(2^(0:7), min(returns.modwt.cor[-(J+1),])-0.03,
labels=exchange.names[YmaxR], adj=0.5, cex=.5)
# }
Run the code above in your browser using DataLab