WC function (bivariate case) computes the wavelet
correlation by means of the function wave.-correlation of
the waveslim package to several time series, makes a
pairwise comparisons and plot the pairwise wavelet correlations in
descending order as a single heatmap using the colorspace
package. 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.
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).
The wavelet function or filter to use in the decomposition.
Specifies the depth of the decomposition.
The type of the output device (by default the option is “screen”, and the other options are “jpg”, “png”, “eps” and “pdf”).
The output filename.
The height of the 'jpg' or 'png' image.
The width of the 'jpg' or 'png' image.
The height of the 'eps' or 'pdf'.
The width of the 'eps' or 'pdf'.
WC function compute the wavelet correlation among
time series and plots the results in a single heatmap plot
(which can be displayed in the screen or can be saved as
PNG, JPG, PDF or EPS) showing the WC values as a table (please,
look at Figure 1 in Polanco-Martinez and Fernandez-Macho 2014). The
WC code is based on the wave.correlation routine
from Brandon Whitcher's waveslim R package 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).
Output plot: screen or 'filename + .png, .jpg, .eps or .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 WC plot) with a J (number of wavelet scales) X C (the number of pairwise comparisons) dimensions, which are in descending order taking into account the sum of the wavelet correlation coefficients for all (J) wavelet scales.
Needs waveslim package to calculate modwt, brick.wall and the wave.correlation and also needs the colorspace package to plot the heatmaps.
Josue M. Polanco-Martinez (a.k.a. jomopo).
BC3 - Basque Centre for Climate Change, Bilbao, Spain.
Email: [email protected]
Gencay, R., F. Selcuk and B. Whitcher (2001). An
Introduction to Wavelets and Other Filtering Methods in Finance
and Economics, Academic Press.
Ihaka, R., Murrell, P., Hornik, K., Fisher, J. C. and Zeileis, A.
(2012). colorspace: Color Space Manipulation. R package version
1.2.0. The Comprehensive R Archive Network (CRAN),
Polanco-Martinez, J. and J. Fernandez-Macho (2014). The
package 'W2CWM2C': description, features and applications.
Computing in Science & Engineering, 16(6):68–78.
Whitcher, B., P. Guttorp, and D.B. Percival (2000). Wavelet analysis of
covariance with application to atmospheric time series.
Journal of Geophysical Research - Atmospheres, 105(D11):941–962.
Whitcher, B. (2012). waveslim: Basic wavelet routines for one-,
two- and three-dimensional signal processing. R package version 1.7.1.
The Comprehensive R Archive Network (CRAN),
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
## Figure 1 (Polanco-Martinez and Fernandez-Macho 2014). library("colorspace") 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 of #:: 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) inputDATA <- ts(lrdatex, start=1, frequency=1) #Input parameters Wname <- "la8" J <- 8 compWC <- WC(inputDATA, Wname, J, device="screen", NULL, NULL, NULL, NULL, NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.