Learn R Programming

W2CWM2C (version 1.0)

WCC: Wavelet cross-correlation (bivariate case).

Description

The WCC function (bivariate case) computes the wavelet cross correlation using the spin.correlation function of the waveslim package for two time series and presents the result as a novel plot that reduce the number of plots of the classical function spin.correlation.

Usage

WCC(inputDATA, Wname, J, lmax, Hpdf, Wpdf)

Arguments

inputDATA
A couple of time series as a ts object (please, check the ts manual to get more information about the ts function in R).
Wname
The wavelet function or filter to use in the decomposition.
J
Specifies the depth of the decomposition.
lmax
The maximum lag.
Hpdf
The height of the pdf file (output plot).
Wpdf
The width of the pdf file (output plot).

Value

  • Output:

    Output pdf file: wcc_ + var1 + var 2 .pdf

    returns.cross.cor: a matrix with the WCC values.

encoding

latin1

Details

The WCC function compute the Wavelet cross-correlation between two time series and plot the results in a single pdf file ('wcc + var1 + var2.pdf') (please, see the Figure 3 of Polanco-Martinez and Fernandez-Macho 2012). The WCC code is based on the spin.correlation routine from Brandon Whitcher's waveslim Rpackage Version: 1.7.1, which is based mainly on wavelet methodology developed in Whitcher, B., P. Guttorp and D.B. Percival (2000) and Gencay, Selcuk and Whitcher (2001).

References

Gencay, R., F. Selcuk and B. Whitcher (2001). An Introduction to Wavelets and Other Filtering Methods in Finance and Economics, Academic Press. Polanco-Martinez, J. and J. Fernandez-Macho (2012). The package 'W2CWM2C': description, features and applications. To be submitted under review to Journal of Statistical Software. Whitcher, B., P. Guttorp, and D.B. Percival. Wavelet analysis of covariance with application to atmospheric time series. Journal of Geophysical Research - Atmospheres, 105(D11):941-962, 2000. Whitcher, B. (2012). Waveslim reference manual. The Comprehensive R Archive Network (CRAN), http://cran.r-project.org/web/packages/waveslim/index.html

Examples

Run this code
## See the Figure 3 of Polanco-Martinez and Fernandez-Macho 
## 2012 (to be submitted under review to Journal of 
## Statistical Software). 

 library("waveslim")
 library("W2CWM2C")
 data(dataexample)  

 #:: Convert. log return using: ln(t + deltat) - ln(t) 
 #:: The application in this example is with stock market 
 #:: indexes and it is common to use log returns instead 
 #:: raw data. Other kinds of pre-processing data are possible. 

 dataexample  <- dataexample[-1] #remove the dates!
 DAXCAC       <- dataexample[,c(3,4)] 
 lrdatex      <- apply(log(DAXCAC), 2, diff)
 tslrdat      <- ts(lrdatex, start=1, frequency=1)

 Wname   <- "la8"
 J       <- 8
 Hp      <- 6
 Wp      <- 10
 lmax    <- 30
 compWCC <- WCC(tslrdat, Wname, J, lmax, Hp, Wp)

Run the code above in your browser using DataLab