Learn R Programming

W2CWM2C (version 1.0)

WC: Wavelet correlation (bivariate case) pairwise comparisons.

Description

The WC function (bivariate case) computes the Wavelet correlation by means of the function wave.correlation of the waveslim package to several time series and make a pairwise comparisons and plot the wavelet correlation as a single pdf file plot. The input data are multivariate time series and this function only tackle arrays with N x C (elements x columns, where the number of columns are between 2 and 7) dimensions.

Usage

WC(inputDATA, Wname, J, Hpdf, Wpdf)

Arguments

inputDATA
An array of multivariate 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.
Hpdf
The height of the pdf file (output plot).
Wpdf
The width of the pdf file (output plot).

Value

  • Output:

    Output pdf file: WCplot.pdf.

    wavcor.modwtsDAT: matrix with as many rows as levels in the wavelet transform object. The first column provides the point estimate for the wavelet correlation followed by the lower and upper bounds from the confidence interval. to3DpL: A matrix (the matrix table added in the WCplot.pdf plot) with a J (number of wavelet scales) X C (the number of pairwise comparisons) dimensions.

encoding

latin1

Details

The WC function compute the wavelet correlation among time series and plots the results in a single pdf file (WCplot.pdf) showing the WC values as a table (please, see the Figure 1 of Polanco-Martinez and Fernandez-Macho 2012). The WC code is based on the wave.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 1 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 returns 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 dates!
 dataexample  <- dataexample[,1:5]
 lrdatex      <- apply(log(dataexample), 2, diff)
 tslrdat      <- ts(lrdatex, start=1, frequency=1) 

 #Input parameters 
  Wname       <- "la8"
  J           <- 8 
  Hp          <- 6
  Wp          <- 10
  tslrdat     <- tslrdat[,1:5]
  compWC      <- WC(tslrdat, Wname, J, Hp, Wp)

Run the code above in your browser using DataLab