Description Usage Arguments Value Author(s) References See Also Examples
This function reconstructs a (detrended) time series analyzed
by wavelet transformation using either function
analyze.wavelet
or function analyze.coherency
, subject to
optional criteria concerning: minimum wavelet power, significance of wavelet power at a
given significance level, specification of (Fourier) periods or
period bands, exclusive use of the power ridge and/or the cone of influence.
An option is provided to prevent the reconstructed series from final rescaling
(applying the original (detrended) series' mean and standard deviation).
(If the object provided as input is of class "analyze.coherency"
,
then the number or name of the time series must be specified.)
Optional: plot of wavelets used for reconstruction, plot of reconstructed series against original (detrended) series. An option is given to individualize the time axis by specifying tick marks and labels.
Output includes the original (detrended) and the reconstructed time series, along with reconstruction waves and parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | reconstruct(WT, my.series = 1, lvl = 0,
only.coi = FALSE,
only.sig = TRUE, siglvl = 0.05,
only.ridge = FALSE,
sel.period = NULL, sel.lower = NULL, sel.upper = NULL,
rescale = TRUE,
plot.waves = FALSE, plot.rec = TRUE,
lty = 1, lwd = 1, col = 1:2, ylim = NULL,
show.legend = TRUE,
legend.coords = "topleft", legend.horiz = FALSE, legend.text = NULL,
label.time.axis = TRUE,
show.date = FALSE, date.format = NULL, date.tz = NULL,
timelab = NULL, timetck = 0.02, timetcl = 0.5,
spec.time.axis = list(at = NULL, labels = TRUE,
las = 1, hadj = NA, padj = NA),
main.waves = NULL, main.rec = NULL, main = NULL,
lwd.axis = 1,
verbose = TRUE)
|
WT |
an object of class |
my.series |
In case Default: |
lvl |
minimum level of wavelet power to be applied for the inclusion of reconstruction waves. Default: |
only.coi |
Exclude borders influenced by edge effects in reconstruction, i.e. include the cone of influence only? Logical. Default: |
only.sig |
Use wavelet power significance in reconstruction? Logical. Default: |
siglvl |
level of wavelet power significance to be applied for the inclusion of reconstruction waves. Default: 0.05. |
only.ridge |
Select only the wavelet power ridge? Logical. Default: |
sel.period |
a vector of numbers to select Fourier periods (or closest available periods) and corresponding wavelets for the reconstruction. Default: |
sel.lower |
a number to define a lower Fourier period (or the closest available) for the selection
of a band of wavelets for the reconstruction. Default: |
sel.upper |
a number to define an upper Fourier period (or the closest available) for the selection
of a band of wavelets for the reconstruction. Default: |
rescale |
Shall the reconstructed series finally be rescaled to attain the original (detrended) series' mean and standard deviation? Logical. Default: |
plot.waves |
Shall reconstruction waves be plotted? Logical. Default: |
plot.rec |
Shall the reconstructed series (together with the original (detrended) series) be plotted? Logical. Default: |
lty |
parameter for the plot of original vs. reconstructed series: line type, e.g. Default: |
lwd |
parameter for the plot of original vs. reconstructed series: line width, e.g. Default: |
col |
parameter for the plot of original vs. reconstructed series: color of lines. Default: |
ylim |
numeric vector of length Default: |
show.legend |
Include legend into the plot of original vs. reconstructed series? Logical. Default: |
legend.coords |
coordinates to position the legend (as in function Default: |
legend.horiz |
Set the legend horizontally rather than vertically? Logical. Default: |
legend.text |
legend text. Default: |
label.time.axis |
Label the time axis? Logical. Default: |
show.date |
Show calendar dates? (Effective only if dates are available as row names or by variable
Default: |
date.format |
the format of calendar date given as a character string, e.g. Default: |
date.tz |
a character string specifying the time zone of calendar date; see Default: |
timelab |
Time axis label. Default: |
timetck |
length of tick marks on the time axis as a fraction of the smaller of the width or height of the plotting region; see Default here: |
timetcl |
length of tick marks on the time axis as a fraction of the height of a line of text; see Default here: |
spec.time.axis |
a list of tick mark and label specifications for individualized time axis labeling
(only effective if
Mismatches will result in a reset to default plotting. |
main.waves |
an overall title for the plot of reconstruction waves. Default: |
main.rec |
an overall title for the plot of original vs. reconstructed series. Default: |
main |
an overall title for both plots. Default: |
lwd.axis |
line width of axes. Default: |
verbose |
Print verbose output on the screen? Logical. Default: |
A list of class reconstruct
with the following elements:
series |
a data frame building on
Row names are taken over from WT$series, and so are dates if given as row names.
If |
rec.waves |
data frame of scaled waves used for reconstruction |
loess.span |
parameter |
lvl |
minimum level of wavelet power for waves (wave segments) to be included in the reconstruction |
only.coi |
Was the influence of edge effects excluded? I.e. was the cone of influence used only? |
only.sig |
Was wavelet power significance used in reconstruction? |
siglvl |
level of wavelet power significance |
only.ridge |
Was the wavelet power ridge used only? |
rnum.used |
the vector of Fourier period numbers used for reconstruction |
rescale |
Was the reconstructed series rescaled according to the mean and standard deviation taken from the original (detrended) series? |
dt |
time resolution, i.e. sampling resolution in the time domain, |
dj |
frequency resolution, i.e. sampling resolution in the frequency domain, |
Period |
the Fourier periods
(measured in time units determined by |
Scale |
the scales (the Fourier periods divided by the Fourier factor) |
nc |
number of columns = number of observations = number of observation epochs; "epoch" meaning point in time |
nr |
number of rows = number of scales (Fourier periods) |
axis.1 |
tick levels corresponding to the time steps used for (cross-)wavelet transformation: |
axis.2 |
tick levels corresponding to the log of Fourier periods: |
date.format |
the format of calendar date (if available) |
date.tz |
the time zone of calendar date (if available) |
Angi Roesch and Harald Schmidbauer
Carmona R., Hwang W.-L., and Torresani B., 1998. Practical Time Frequency Analysis. Gabor and Wavelet Transforms with an Implementation in S. Academic Press, San Diego.
Liu Y., Liang X.S., and Weisberg R.H., 2007. Rectification of the Bias in the Wavelet Power Spectrum. Journal of Atmospheric and Oceanic Technology 24, 2093–2102.
Torrence C., and Compo G.P., 1998. A practical guide to wavelet analysis. Bulletin of the American Meteorological Society 79 (1), 61–78.
analyze.wavelet
, wt.image
, wt.avg
, wt.sel.phases
, wt.phase.image
, analyze.coherency
,
wc.image
, wc.avg
, wc.sel.phases
, wc.phasediff.image
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | ## Not run:
## The following example is adopted from Liu et al., 2007:
series.length = 6*128*24
x1 <- periodic.series(start.period = 1*24, length = series.length)
x2 <- periodic.series(start.period = 8*24, length = series.length)
x3 <- periodic.series(start.period = 32*24, length = series.length)
x4 <- periodic.series(start.period = 128*24, length = series.length)
x <- x1 + x2 + x3 + x4
plot(x, type = "l", xlab = "index", ylab = "", xaxs = "i",
main = "hourly series with periods of 1, 8, 32, 128 days")
my.data <- data.frame(x = x)
## Computation of wavelet power:
## a natural choice of 'dt' in the case of hourly data is 'dt = 1/24',
## resulting in one time unit equaling one day.
## This is also the time unit in which periods are measured.
my.w <- analyze.wavelet(my.data, "x",
loess.span = 0,
dt = 1/24, dj = 1/20,
lowerPeriod = 1/4,
make.pval = TRUE, n.sim = 10)
## Plot of wavelet power spectrum (with equidistant color breakpoints):
wt.image(my.w, color.key = "interval",
legend.params = list(lab = "wavelet power levels"),
periodlab = "period (days)")
## Reconstruction of the time series,
## including significant components only:
reconstruct(my.w)
## The same reconstruction, but showing wave components first:
reconstruct(my.w, plot.waves = TRUE)
## Reconstruction, including all components whether significant or not:
reconstruct(my.w, only.sig = FALSE)
## Reconstruction, including significant components,
## but selected periods only (e.g. ignoring period 8):
reconstruct(my.w, sel.period = c(1,32,128))
## Reconstruction, including significant components,
## but the ridge only:
reconstruct(my.w, only.ridge = TRUE)
## Alternate styles of the time axis:
## The plot with time elapsed in days, starting from 0 and proceeding
## in steps of 50 days (50*24 hours),
## instead of the (default) time index:
index.ticks <- seq(1, series.length, by = 50*24)
index.labels <- (index.ticks-1)/24
## Insert your specification of time axis:
reconstruct(my.w, only.ridge = TRUE,
timelab = "time elapsed (days)",
spec.time.axis = list(at = index.ticks, labels = index.labels))
## See the periods involved:
my.rec <- reconstruct(my.w, only.ridge = TRUE)
print(my.rec$Period[my.rec$rnum.used])
## The original and reconstructed time series can be retrieved:
plot(my.rec$series$x, type = "l", xlab = "index", ylab = "")
lines(my.rec$series$x.r, col="red")
legend("topleft", legend = c("original","reconstructed"),
lty = 1, col = c("black","red"))
## Please see also the examples in our guide booklet,
## URL http://www.hs-stat.com/projects/WaveletComp/WaveletComp_guided_tour.pdf.
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.