plot.TLSW {TrendLSW} | R Documentation |
Plot Trend and/or Spectrum Information in a TLSW
Object
Description
Plots information contained within a TLSW
object.
Depending on the plot.type
option this will produce a plot of the data
with trend estimate overlayed, a plot of the spectral estimate, or both (default).
If the TLSW
object does not contain trend or spectral estimates and these are requested
a warning will be given.
Usage
## S3 method for class 'TLSW'
plot(
x,
plot.type = c("trend", "spec"),
trend.plot.args,
spec.plot.args,
plot.CI = TRUE,
...
)
Arguments
x |
A |
plot.type |
A string object indicating what is to be plotted. Can be:
|
trend.plot.args |
A list object, that includes any choices for the graphical parameters used for plotting the trend estimate. |
spec.plot.args |
A list object, that includes any choices for the graphical parameters used for plotting the spectral estimate. |
plot.CI |
A logical variable. If TRUE, the confidence interval of the trend estimate (if computed) will be included in the plot. |
... |
Any additional arguments that will be applied to the graphical parameters of both the trend and spectrum plotting. |
Details
A TLSW object can be plotted using the standard plot
function in R to display the
estimated trend function and wavelet spectrum. The estimated trend is visualised using
plot.default
. Visualisation of the estimated spectrum is
based on plot.wd
, for which credit belongs to Guy Nason.
Graphical parameters for customising the display of the trend or spectrum plots should be given
to the trend.plot.args
and spec.plot.args
arguments respectively.
For graphical parameters for the trend plot:
Parameters related to the overall plot should be provided as they usually would be when using the
plot
function, in thetrend.plot.args
list object. For example, to change the title of the plot to "Plot", usemain = "Plot"
.Parameters affecting the display of the estimated trend line should begin with the prefix
"T."
. For example, to set the colour of the trend line to blue, useT.col = "blue"
.Parameters affecting the display of the confidence interval lines should begin with the prefix
"CI."
. For example, to set the line width of the confidence interval to 2, useCI.lwd = 2
.Parameters affecting the display of the polygon drawn by the confidence interval should begin with the prefix
"poly."
. For example, to set the colour of the confidence interval region to green, usepoly.col = "green"
.
Value
No return value, called for side effects
References
McGonigle, E. T., Killick, R., and Nunes, M. (2022). Modelling time-varying first and second-order structure of time series via wavelets and differencing. Electronic Journal of Statistics, 6(2), 4398-4448.
McGonigle, E. T., Killick, R., and Nunes, M. (2022). Trend locally stationary wavelet processes. Journal of Time Series Analysis, 43(6), 895-917.
See Also
TLSW
, summary.TLSW
, print.TLSW
, plot.wd
Examples
# Simulates an example time series and estimates its trend and evolutionary wavelet spectrum.
# Then plots both estimates.
spec <- matrix(0, nrow = 9, ncol = 512)
spec[1, ] <- 4 + 4 * sin(seq(from = 0, to = 2 * pi, length = 512))^2
trend <- seq(from = 0, to = 10, length = 512) + 2 * sin(seq(from = 0, to = 2 * pi, length = 512))
set.seed(1)
x <- TLSWsim(trend = trend, spec = spec)
x.TLSW <- TLSW(x)
plot(x.TLSW, trend.plot.args = list(
ylab = "Simulated Data", T.col = 4,
T.lwd = 2, T.lty = 2
))