plot.exdqlmFit: Plot Method for Dynamic 'exdqlmFit' Objects

View source: R/exdqlmFit_methods.R

plot.exdqlmFitR Documentation

Plot Method for Dynamic exdqlmFit Objects

Description

Plot fitted dynamic quantiles, fitted component contributions, or individual state elements from a dynamic fit. The default type = "quantile", plots the MAP estimates and 95% credible intervals (CrIs) of the dynamic quantile. type = "component" plots the MAP estimates and CrIs for a specified component. type = "state" plots the MAP estimates and CrIs of a single element of the dynamic state vector.

Usage

## S3 method for class 'exdqlmFit'
plot(
  x,
  type = c("quantile", "component", "state"),
  index = NULL,
  add = FALSE,
  col = "purple",
  cr.percent = 0.95,
  xlim = NULL,
  ylim = NULL,
  xlab = "time",
  ylab = NULL,
  lwd = 1.5,
  lwd.interval = 0.75,
  lty.interval = 2,
  ...
)

Arguments

x

A fitted dynamic exdqlmFit object.

type

Character string specifying the plot type. Use "quantile" for the fitted dynamic quantile, "component" for the contribution of a block of state elements, or "state" for a single state element.

index

Required for type = "component" or type = "state". For type = "state", index must have length 1 indicating a single element of the state vector to be plotted. For type = "component", index should be consecutive state indices in \{1,\dots,q\} indicating the component to be plotted.

add

Optional logical value indicating whether the estimate will be added to existing plot. Default is FALSE.

col

Optional character vector of length 1 giving color of the estimate to be plotted. Default is purple.

cr.percent

Optional numeric in (0, 1) indicating the probability mass for the credible intervals (e.g., 0.95). Default 0.95.

xlim, ylim

Optional limits passed to the base plotting call.

xlab, ylab

Optional axis labels passed to the base plotting call.

lwd, lwd.interval

Line widths for the estimate and credible interval bounds, respectively.

lty.interval

Line type for the credible interval bounds.

...

Additional arguments.

Value

Invisibly returns a list of the following:

  • map.quant - MAP estimate of the dynamic estimate.

  • lb.quant - Lower bound of the 95% CrIs of the dynamic estimate.

  • ub.quant - Upper bound of the 95% CrIs of the dynamic estimate.

  • x - Time/index values used for plotting.

Examples


data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:80]
trend.comp = polytrendMod(2, rep(mean(y), 2), 10*diag(2))
seas.comp = seasMod(365, c(1, 2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.98, 1), dim.df = c(2, 4),
                   gam.init = -3.5, sig.init = 15,
                   n.samp = 20, tol = 0.2, verbose = FALSE)
# plot quantile
plot(M0)
# plot first harmonic component
plot(M0, type="component", index = c(3, 4), col = "blue")
options(old)


exdqlm documentation built on July 10, 2026, 1:08 a.m.