spin.covariance(waveslim)
spin.covariance()所属R语言包:waveslim
Compute Wavelet Cross-Covariance Between Two Time Series
计算两个时间序列的小波互协方差
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes wavelet cross-covariance or cross-correlation between two time series.
小波计算互协方差或两个时间序列之间的互相关。
用法----------Usage----------
spin.correlation(x, y, lag.max = NA)
参数----------Arguments----------
参数:x
first time series
第一个时间序列
参数:y
second time series, same length as x
第二个时间序列,相同长度的x
参数:lag.max
maximum lag to compute cross-covariance (correlation)
最高滞后计算互协方差(相关)
Details
详细信息----------Details----------
See references.
见参考文献。
值----------Value----------
List structure holding the wavelet cross-covariances (correlations) according to scale.
小波互协方差(相关)根据规模的目录结构。
(作者)----------Author(s)----------
B. Whitcher
参考文献----------References----------
An Introduction to Wavelets and Other Filtering Methods in Finance and Economics, Academic Press.
Wavelet analysis of covariance with application to atmospheric time series, Journal of Geophysical Research, 105, No. D11, 14,941-14,962.
参见----------See Also----------
wave.covariance, wave.correlation.
wave.covariance,wave.correlation。
实例----------Examples----------
## Figure 7.9 from Gencay, Selcuk and Whitcher (2001)[#图7.9 Gencay,塞尔丘克和Whitcher的(2001年)]
data(exchange)
returns <- diff(log(exchange))
returns <- ts(returns, start=1970, freq=12)
wf <- "d4"
demusd.modwt <- modwt(returns[,"DEM.USD"], wf, 8)
demusd.modwt.bw <- brick.wall(demusd.modwt, wf)
jpyusd.modwt <- modwt(returns[,"JPY.USD"], wf, 8)
jpyusd.modwt.bw <- brick.wall(jpyusd.modwt, wf)
n <- dim(returns)[1]
J <- 6
lmax <- 36
returns.cross.cor <- NULL
for(i in 1:J) {
blah <- spin.correlation(demusd.modwt.bw[[i]], jpyusd.modwt.bw[[i]], lmax)
returns.cross.cor <- cbind(returns.cross.cor, blah)
}
returns.cross.cor <- ts(as.matrix(returns.cross.cor), start=-36, freq=1)
dimnames(returns.cross.cor) <- list(NULL, paste("Level", 1:J))
lags <- length(-lmax:lmax)
lower.ci <- tanh(atanh(returns.cross.cor) - qnorm(0.975) /
sqrt(matrix(trunc(n/2^(1:J)), nrow=lags, ncol=J, byrow=TRUE)
- 3))
upper.ci <- tanh(atanh(returns.cross.cor) + qnorm(0.975) /
sqrt(matrix(trunc(n/2^(1:J)), nrow=lags, ncol=J, byrow=TRUE)
- 3))
par(mfrow=c(3,2), las=1, pty="m", mar=c(5,4,4,2)+.1)
for(i in J:1) {
plot(returns.cross.cor[,i], ylim=c(-1,1), xaxt="n", xlab="Lag (months)",
ylab="", main=dimnames(returns.cross.cor)[[2]][i])
axis(side=1, at=seq(-36, 36, by=12))
lines(lower.ci[,i], lty=1, col=2)
lines(upper.ci[,i], lty=1, col=2)
abline(h=0,v=0)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|