## 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(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.date = seq(as.POSIXct("2014-10-14 00:00:00","%F %T"), by="hour",
# length.out=series.length)
# my.data = data.frame(date=my.date, x=x)
#
# my.w = 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.w, color.key="i", timelab="time (days)",
# legend.params=list(lab="wavelet power levels (equidistant levels)"))
#
# ## Select period 16 and plot corresponding phases across time:
# wt.sel.phases(my.w, timelab="time (days)", sel.period=8)
#
# ## The same plot, but with calendar axis:
# wt.sel.phases(my.w, timelab="", sel.period=8,
# show.date=T, date.format="%F %T")
#
# ## In the following, no periods are selected;
# ## the plot shows average phases instead of individual phases:
# wt.sel.phases(my.w, timelab="time (days)", show.avg.phase=T)
#
# ## End(Not run)
Run the code above in your browser using DataLab