Learn R Programming

mvLSW (version 1.2.5)

plot.mvLSW: Plot mvLSW Object

Description

Plot the data contained within a mvLSW object based on the requested format.

Usage

# S3 method for mvLSW
plot(x, style = 1, info = NULL, Interval = NULL, 
    diag = TRUE, sub = "Spectrum", ...)

Arguments

x

A mvLSW object.

style

Index stating the type of plotting format for the mvLSW object. (See details.)

info

Vector containing the channel and/or level indices defining the slice through x according to the requested plotting style. (See details.)

Interval

A list containing two items, both mvLSW objects with names "L" and "U" that respectively define the lower and upper pointwise interval values. If NULL, default, then no interval is plotted.

diag

Logical, should the diagonal panels be drawn when style=2. Ideally this should be FALSE if object contains the coherence. Set to TRUE by default.

sub

Plot subtitle. Set to "Spectrum" by default.

...

Additional graphical parameters.

Value

Generates a plot. No data is returned.

Details

This command plots the data contained within the mvLSW based on requested plotting style.

Plotting style style=1 with information info=c(p,q,j) generates a single plot for a specified channel pair p & q and level j.

Plotting style style=2 with information info=j creates a set of plots from x for all channel pairs in a lower-triangular panel corresponding to the specified level j. If diag=FALSE then the plots along the diagonal are suppressed, which is ideal when x contain coherence estimates.

Plotting style style=3 with information info=c(p,q) creates a set of plots from x for all levels (from fine to coarse) for channel pair p and q.

Finally, the plotting style style=4 with information info=c(p,q) presents the same information as for the previous case, but in a compact matrix format. Please refer to image.plot from the fields library for additional information on this plotting style.

The argument Interval must be supplied in order to draw a polygon depicting the pointwise interval. See ApxCI for deriving an approximate confidence interval for the evolutionary wavelet spectrum estimate. This argument is ignored in the case style=4.

References

Taylor, S.A.C., Park, T.A. and Eckley, I. (2019) Multivariate locally stationary wavelet analysis with the mvLSW R package. Journal of statistical software 90(11) pp. 1--16, doi: 10.18637/jss.v090.i11.

See Also

plot.default, image.plot, as.mvLSW, mvEWS, coherence, ApxCI.

Examples

Run this code
# NOT RUN {
## Define evolutionary wavelet spectrum, structure only on level 2
Spec <- array(0, dim=c(3, 3, 8, 256))
Spec[1, 1, 2, ] <- 10
Spec[2, 2, 2, ] <- c(rep(5, 64), rep(0.6, 64), rep(5, 128))
Spec[3, 3, 2, ] <- c(rep(2, 128), rep(8, 128))
Spec[2, 1, 2, ] <- Spec[1, 2, 2, ] <- punif(1:256, 65, 192)
Spec[3, 1, 2, ] <- Spec[1, 3, 2, ] <- c(rep(-1, 128), rep(5, 128))
Spec[3, 2, 2, ] <- Spec[2, 3, 2, ] <- -0.5
EWS <- as.mvLSW(x = Spec, filter.number = 1, family = "DaubExPhase",
  min.eig.val = NA)

## Sample time series and estimate the EWS and coherence.
set.seed(10)
X <- rmvLSW(Spectrum = EWS)
EWS_X <- mvEWS(X, kernel.name = "daniell", kernel.param = 20)
RHO_X <- coherence(EWS_X, partial = FALSE)

## Evaluate asymptotic spectral variance 
SpecVar <- varEWS(EWS_X)

## Evaluate 95% approximate confidence interval
CI <- ApxCI(object = EWS_X, var = SpecVar, alpha=0.05)

## Plot mvEWS between channels 1 & 3 at level 2
plot(x = EWS_X, style = 1, info = c(1, 3, 2), Interval = CI)

## Plot coherence between channels 1 & 3 at level 2
plot(x = RHO_X, style = 1, info = c(1, 3, 2), ylab = "Coherence")

## mvEWS panel plot for level 2
plot(x = EWS_X, style = 2, info = 2, Interval = CI)

## Panel plot of coherence for level 2
plot(x = RHO_X, style = 2, info = 2, diag = FALSE, ylab = "Coherence")

## Plot mvEWS for channel pair 1 & 3 at all levels
plot(x = EWS_X, style = 3, info = c(1, 3), Interval = CI)

## Plot coherence for channel pair 1 & 3 at all levels
plot(x = RHO_X, style = 3, info = c(1, 3), ylab = "Coherence")

## Image plot for coherence between channels 1 & 3
plot(x = RHO_X, style = 4, info = c(1, 3), sub = "Coherence")
# }

Run the code above in your browser using DataLab