Learn R Programming

exdqlm (version 0.1.3)

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(
  y,
  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

y

A univariate time-series.

m1

An object of class "exdqlm".

index

Index of the component or element of the state vector to be plotted.

add

If TRUE, the dynamic component will be added to existing plot.

col

Color of dynamic component to be plotted. Default is purple.

just.theta

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

Percentage used in the calculation of the credible intervals.

Examples

Run this code
# \donttest{
y = scIVTmag[1:365]
trend.comp = polytrendMod(2,rep(0,2),10*diag(2))
seas.comp = seasMod(365,c(1,2,4),C0=10*diag(6))
model = combineMods(trend.comp,seas.comp)
M0 = exdqlmISVB(y,p0=0.85,model,df=c(0.98,1),dim.df = c(2,6),
                   gam.init=-3.5,sig.init=15,tol=0.05)
# plot first harmonic component
compPlot(y,M0,index=c(3,4),col="blue")
# }

Run the code above in your browser using DataLab