Description Usage Arguments Value References Examples
This function computes the Windowed Scalogram Difference of two signals. The definition and details can be found in (Bolós et al. 2017).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  wsd(signal1,
signal2,
dt = 1,
scaleparam = NULL,
windowrad = NULL,
rdist = NULL,
delta_t = NULL,
normalize = c("NO", "ENERGY", "MAX", "SCALE"),
refscale = NULL,
wname = c("MORLET", "DOG", "PAUL", "HAAR", "HAAR2"),
wparam = NULL,
waverad = NULL,
border_effects = c("BE", "INNER", "PER", "SYM"),
mc_nrand = 0,
commutative = TRUE,
wscnoise = 0.02,
compensation = 0,
energy_density = TRUE,
parallel = FALSE,
makefigure = TRUE,
time_values = NULL,
figureperiod = TRUE,
xlab = "Time",
ylab = NULL,
main = "log2(WSD)",
zlim = NULL)

signal1 
A vector containing the first signal. 
signal2 
A vector containing the second signal (its length should be equal to
that of 
dt 
Numeric. The time step of the signals. 
scaleparam 
A vector of three elements with the minimum scale, the maximum scale and the number of suboctaves per octave for constructing power 2 scales (following Torrence and Compo 1998). If NULL, they are automatically constructed. 
windowrad 
Integer. Time radius for the windows, measured in 
rdist 
Integer. Logscale radius for the windows measured in suboctaves. By default, it is set to ceiling(length(scales) / 20). 
delta_t 
Integer. Increment of time for the construction of windows central
times, measured in 
normalize 
String, equal to "NO", "ENERGY", "MAX" or "SCALE". If "ENERGY", signals are
divided by their respective energies. If "MAX", each signal is divided by the maximum
value attained by its scalogram. In these two cases, 
refscale 
Numeric. The reference scale for 
wname 
A string, equal to "MORLET", "DOG", "PAUL", "HAAR" or "HAAR2". The difference between "HAAR" and "HAAR2" is that "HAAR2" is more accurate but slower. 
wparam 
The corresponding nondimensional parameter for the wavelet function (Morlet, DoG or Paul). 
waverad 
Numeric. The radius of the wavelet used in the computations for the cone of influence. If it is not specified, it is asumed to be √{2} for Morlet and DoG, 1/√{2} for Paul and 0.5 for Haar. 
border_effects 
String, equal to "BE", "INNER", "PER" or "SYM", which indicates how to manage the border effects which arise usually when a convolution is performed on finitelenght signals.

mc_nrand 
Integer. Number of Montecarlo simulations to be performed in order to determine the 95% and 5% significance contours. 
commutative 
Logical. If TRUE (default) the commutative windowed scalogram difference. Otherwise a noncommutative (but simpler) version is computed (see Bolós et al. 2017). 
wscnoise 
Numeric in [0,1]. If a (windowed) scalogram takes values close to zero, some problems may appear because we are considering relative differences. Specifically, we can get high relative differences that in fact are not relevant, or even divisions by zero. If we consider absolute differences this would not happen but, on the other hand, using absolute differences is not appropriate for scalogram values not close to zero. So, the parameter Finally, 
compensation 
Numeric. It is an alternative to 
energy_density 
Logical. If TRUE (default), divide the scalograms by the square
root of the scales for convert them into energy density. Note that it does not affect
the results if 
parallel 
Logical. If TRUE, it uses function 
makefigure 
Logical. If TRUE (default), a figure with the WSD is plotted. 
time_values 
A numerical vector of length 
figureperiod 
Logical. If TRUE (default), periods are used in the figure instead of scales. 
xlab 
A string giving a custom X axis label. 
ylab 
A string giving a custom Y axis label. If NULL (default) the Y label is
either "Scale" or "Period" depending on the value of 
main 
A string giving a custom main title for the figure. 
zlim 
A vector of length 2 with the limits for the zaxis (the color bar). 
A list with the following fields:
wsd
: A matrix of size length(tcentral)
x length(scales)
containing the values of the windowed scalogram differences at each scale and at each
time window.
tcentral
: The vector of central times used in the computations of the
windowed scalograms.
scales
: The vector of scales.
windowrad
: Radius for the time windows of the windowed scalograms,
measured in dt
.
rdist
: The logscale radius for the windows measured in suboctaves.
signif95
: A logical matrix of size length(tcentral)
x
length(scales)
. If TRUE, the corresponding point of the wsd
matrix is in
the 95% significance.
signif05
: A logical matrix of size length(tcentral)
x
length(scales)
. If TRUE, the corresponding point of the wsd
matrix is in
the 5% significance.
fourierfactor
: A factor for converting scales into periods.
coi_maxscale
: A vector of length length(tcentral)
containing the
values of the maximum scale from which there are border effects for the respective
central time.
C. Torrence, G. P. Compo. A practical guide to wavelet analysis. B. Am. Meteorol. Soc. 79 (1998), 61–78.
V. J. Bolós, R. Benítez, R. Ferrer, R. Jammazi. The windowed scalogram difference: a novel wavelet tool for comparing time series. Appl. Math. Comput., 312 (2017), 4965.
1 2 3 4 5 6 7 8 9 10  nt < 1500
time < 1:nt
sd_noise < 0.2 #% In BolÃ³s et al. 2017 Figure 1, sd_noise = 1.
signal1 < rnorm(n = nt, mean = 0, sd = sd_noise) + sin(time / 10)
signal2 < rnorm(n = nt, mean = 0, sd = sd_noise) + sin(time / 10)
signal2[500:1000] = signal2[500:1000] + sin((500:1000) / 2)
## Not run:
wsd < wsd(signal1 = signal1, signal2 = signal2)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.