Produces plots for an MTDest object. By default, it shows in sequence:
(i) barplot of oscillations by relevant lag, (ii) barplot of mixture weights
\(\lambda_j\) (including lam0 if > 0), and (iii) graphs of
pj (one graph for each lag in Lambda). If EM diagnostics are
available, a convergence panel (log-likelihood variation per update) is shown
last. When type is specified, only the requested plot is drawn.
# S3 method for MTDest
plot(x, type, main, ylim, col = "gray70", border = NA, pj_index = 1, ...)If type is "oscillation" or "lambdas", invisibly returns
the numeric vector that was plotted. If type = "pj", invisibly returns
the selected transition matrix pj(x)[[pj_index]]. If
type = "convergence", invisibly returns the numeric vector
deltaLogLik. If type is missing, invisibly returns the list
produced by plot.MTD(m) (typically with components oscillation
and lambdas); if deltaLogLik is available, the returned list also
includes deltaLogLik.
An object of class "MTDest".
If type is missing, oscillation, lambdas,
pj graphs and—if available—the convergence plots are shown
sequentially (press Enter to proceed). Else, type is a character string
indicating what to plot: "oscillation", "lambdas", "pj" or
"convergence".
Optional main title. When type is missing, panel-specific
defaults are used and main is ignored.
Optional y-axis limits. When type is missing, panel-specific
defaults are used and ylim is ignored.
Bar fill color (passed to barplot). Defaults to "gray70".
Bar border color (for bar plots). Defaults to NA.
Integer index of pj(x) to plot when
type = "pj" (default 1).
Further graphical parameters: passed to barplot() when
type %in% c("oscillation","lambdas"), to plot.igraph() when
type = "pj", and to plot() when type = "convergence".
Ignored when type is missing.
For type = "oscillation", the function delegates to plot.MTD(),
which returns \(\delta_j = \lambda_j \max_{b,c} d_{TV}(p_j(\cdot|b), p_j(\cdot|c))\)
for each lag in lags(x), and draws a bar plot named by the lags.
For type = "lambdas", the function delegates to plot.MTD(),
it plots the mixture weights \(\lambda_j\) by lag. If lam0 > 0, the
weight for the independent component is included and labeled "0".
For type = "pj", the function delegates to plot.MTD(),
it draws the directed, weighted graph of the transition matrices pj
taken from pj(x). Vertices correspond to the states states(x).
A directed edge a -> b carries weight p_j(b | a). Edge widths
and edge labels are proportional to the transition probabilities (labels
shown in the plot are rounded to two decimals). By default,
self-loops (a -> a) are not drawn. The self-loop probability
at a state a can be inferred as $$1 - \sum_{b: b \ne a} p_j(b \mid a).$$
For type = "pj", a specific matrix can be selected via pj_index
(e.g., pj_index = 2 plots pj(x)[[2]]). In automatic mode (when
type is missing), graphs for all pj matrices are shown
sequentially.
If EM iteration diagnostics are available (i.e., the object was fitted with
iter = TRUE and length(deltaLogLik) > 0), a convergence panel
showing the log-likelihood variation per update is displayed automatically
when type is missing. You can also request it explicitly with
type = "convergence".
plot.MTD, as.MTD, MTDest
if (FALSE) {
set.seed(1)
M <- MTDmodel(Lambda = c(1, 3), A = c(0, 1), lam0 = 0.05)
X <- perfectSample(M, N = 300)
fit <- MTDest(X, S = c(1, 3), init = coef(M), iter = TRUE)
plot(fit)
plot(fit, type = "pj", pj_index = 2)
plot(fit, type = "convergence")
}
Run the code above in your browser using DataLab