pwtc {biwavelet} | R Documentation |
Compute partial wavelet coherence
Description
Compute partial wavelet coherence between y
and x1
by
partialling out the effect of x2
Usage
pwtc(
y,
x1,
x2,
pad = TRUE,
dj = 1/12,
s0 = 2 * dt,
J1 = NULL,
max.scale = NULL,
mother = "morlet",
param = -1,
lag1 = NULL,
sig.level = 0.95,
sig.test = 0,
nrands = 300,
quiet = FALSE
)
Arguments
y |
Time series |
x1 |
Time series |
x2 |
Time series |
pad |
Pad the values will with zeros to increase the speed of the transform. |
dj |
Spacing between successive scales. |
s0 |
Smallest scale of the wavelet. |
J1 |
Number of scales - 1. |
max.scale |
Maximum scale. Computed automatically if left unspecified. |
mother |
Type of mother wavelet function to use. Can be set to
|
param |
Nondimensional parameter specific to the wavelet function. |
lag1 |
Vector containing the AR(1) coefficient of each time series. |
sig.level |
Significance level. |
sig.test |
Type of significance test. If set to 0, use a regular
|
nrands |
Number of Monte Carlo randomizations. |
quiet |
Do not display progress bar. |
Value
Return a biwavelet
object containing:
coi |
matrix containg cone of influence |
wave |
matrix containing the cross-wavelet transform of |
rsq |
matrix of partial wavelet coherence between |
phase |
matrix of phases between |
period |
vector of periods |
scale |
vector of scales |
dt |
length of a time step |
t |
vector of times |
xaxis |
vector of values used to plot xaxis |
s0 |
smallest scale of the wavelet |
dj |
spacing between successive scales |
y.sigma |
standard deviation of |
x1.sigma |
standard deviation of |
mother |
mother wavelet used |
type |
type of |
signif |
matrix containg |
Note
The Monte Carlo randomizations can be extremely slow for large datasets. For instance, 1000 randomizations of a dataset consisting of 1000 samples will take ~30 minutes on a 2.66 GHz dual-core Xeon processor.
Author(s)
Tarik C. Gouhier (tarik.gouhier@gmail.com) Code based on WTC MATLAB package written by Aslak Grinsted.
References
Aguiar-Conraria, L., and M. J. Soares. 2013. The Continuous Wavelet Transform: moving beyond uni- and bivariate analysis. Journal of Economic Surveys In press.
Cazelles, B., M. Chavez, D. Berteaux, F. Menard, J. O. Vik, S. Jenouvrier, and N. C. Stenseth. 2008. Wavelet analysis of ecological time series. Oecologia 156:287-304.
Grinsted, A., J. C. Moore, and S. Jevrejeva. 2004. Application of the cross wavelet transform and wavelet coherence to geophysical time series. Nonlinear Processes in Geophysics 11:561-566.
Ng, E. K. W., and J. C. L. Chan. 2012. Geophysical applications of partial wavelet coherence and multiple wavelet coherence. Journal of Atmospheric and Oceanic Technology 29:1845-1853.
Torrence, C., and G. P. Compo. 1998. A Practical Guide to Wavelet Analysis. Bulletin of the American Meteorological Society 79:61-78.
Torrence, C., and P. J. Webster. 1998. The annual cycle of persistence in the El Nino/Southern Oscillation. Quarterly Journal of the Royal Meteorological Society 124:1985-2004.
Examples
y <- cbind(1:100, rnorm(100))
x1 <- cbind(1:100, rnorm(100))
x2 <- cbind(1:100, rnorm(100))
# Partial wavelet coherence of y and x1
pwtc.yx1 <- pwtc(y, x1, x2, nrands = 0)
# Partial wavelet coherence of y and x2
pwtc.yx2 <- pwtc(y, x2, x1, nrands = 0)
# Plot partial wavelet coherence and phase difference (arrows)
# Make room to the right for the color bar
par(mfrow = c(2,1), oma = c(4, 0, 0, 1),
mar = c(1, 4, 4, 5), mgp = c(1.5, 0.5, 0))
plot(pwtc.yx1, xlab = "", plot.cb = TRUE,
main = "Partial wavelet coherence of y and x1 | x2")
plot(pwtc.yx2, plot.cb = TRUE,
main = "Partial wavelet coherence of y and x2 | x1")