Learn R Programming

exdqlm (version 0.4.0)

compPlot: Plot a component of an exDQLM

Description

The function plots the dynamic MAP estimates and 95% credible intervals (CrIs) of a specified component of an exDQLM. Alternatively, if just.theta=TRUE the MAP estimates and 95% credible intervals (CrIs) of a single element of the dynamic state vector are plotted.

Usage

compPlot(
  m1,
  index,
  add = FALSE,
  col = "purple",
  just.theta = FALSE,
  cr.percent = 0.95
)

Value

A list of the following is returned:

  • map.comp - MAP estimate of the dynamic component (or element of the state vector).

  • lb.comp - Lower bound of the 95% CrIs of the dynamic component (or element of the state vector).

  • ub.comp - Upper bound of the 95% CrIs of the dynamic component (or element of the state vector).

Arguments

m1

An object of class "exdqlmLDVB", "exdqlmMCMC", or legacy "exdqlmISVB".

index

Vector of consecutive integers in \(\{1,\dots,q\}\) indicating the component or element of the state vector to be plotted.

add

Logical value indicating whether the dynamic component will be added to existing plot. Default is FALSE.

col

Character vector of length 1 giving color of the dynamic component to be plotted. Default is purple.

just.theta

Logical; if TRUE, the function plots the dynamic distribution of the index element of the state vector. If just.theta=TRUE, index must have length 1.

cr.percent

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

Examples

Run this code
# \donttest{
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:80]
trend.comp = polytrendMod(2, rep(0, 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 first harmonic component
compPlot(M0, index = c(3, 4), col = "blue")
options(old)
# }

Run the code above in your browser using DataLab