plot.dllm: Plot a Fitted Dynamic Local Level Model

View source: R/plot_dllm.R

plot.dllmR Documentation

Plot a Fitted Dynamic Local Level Model

Description

Produces a plot for an object of class dllm (typically created by dllm). The function displays the observed data along with the fitted curves computed using filtered and/or smoothed state estimates.

Usage

## S3 method for class 'dllm'
plot(
  x,
  type = c("smoother", "filter"),
  plot_data = TRUE,
  obs_cols = NULL,
  obs_colors = NULL,
  filter_colors = NULL,
  smoother_colors = NULL,
  conf.int = FALSE,
  sig.level = 0.95,
  ...
)

Arguments

x

An object of class dllm, as returned by dlm.

type

Character; one of "smoother" or "filter" (default: "smoother"). Specifies which fitted curves to display.

plot_data

Logical; if TRUE (default) the observed data points are plotted.

obs_cols

Character; an optional argument specifying the variables to be plotted. If NULL, plot all variables.

obs_colors

Optional character vector specifying custom colors for observed data. If not supplied, a default palette is used.

filter_colors

Optional character vector specifying custom colors for filtered curves. If not supplied, a default palette is used.

smoother_colors

Optional character vector specifying custom colors for smoothed curves. If not supplied, a default palette is used.

conf.int

Logical; if TRUE, plot confidence intervals with the given sig.level.

sig.level

Numeric; significance level for confidence intervals (default: 0.95).

...

Additional graphical parameters to pass to the underlying plotting functions.

Value

This function produces a plot of the fitted DLM and returns NULL invisibly.


dlmwwbe documentation built on June 8, 2025, 10:07 a.m.