## 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(ts(x, start=0, frequency=24), type="l",
xlab="time (days)",
ylab="hourly data", main="a series of hourly data with periods of 1, 8, 32, and 128 days")
my.data = data.frame(x=x)
my.wt = analyze.wavelet(my.data, "x",
loess.span=0,
dt=1/24, dj=1/20,
lowerPeriod=1/4,
make.pval=T, n.sim=10)
## Plot of wavelet power spectrum (with equidistant color breakpoints):
wt.image(my.wt, color.key="interval", legend.params=list(lab="wavelet power levels"))
## Plot of average wavelet power:
wt.avg(my.wt, siglvl=0.05, sigcol="red")
Run the code above in your browser using DataLab