Learn R Programming

yuima (version 1.15.34)

plot,yuima.kalmanBucyFilter,ANY-method: Plotting Method for Kalman-Bucy Filter

Description

Plotting method for objects of class yuima.kalmanBucyFilter.

Usage

# S4 method for yuima.kalmanBucyFilter,ANY
plot(
  x,
  plot_truth = FALSE,
  level = 0,
  legend = TRUE,
  legend_position = "top",
  legend_cex = 1
)

Value

NULL (plot is drawn)

Arguments

x

A yuima.kalmanBucyFilter-class object.

plot_truth

Logical. If TRUE, plot true values of state variables.

level

Numeric. If 0 < level < 1, plot confidence interval of level.

legend

Logical. If TRUE, a legend is added to the plot.

legend_position

Character. Position of the legend, passed to legend (e.g., "topright", "bottom", "top", "left", or "none").

legend_cex

Numeric. Scaling factor for the legend text size, corresponding to the cex argument in legend.

Author

The YUIMA Project Team

Details

This method plots the estimated values of state variables by Kalman-Bucy filter. Optionally, it can plot true values of state variables which may exist when using simulated data. Also, it can plot confidence interval of level if 0 < level < 1.

Examples

Run this code
if (FALSE) {
# create Kalman-Bucy filter object
drift <- c('a*X', 'c*X')
diffusion <- matrix(
  c('b', '0', '0', 'sigma'),
  2, 2
)
vars <- c('X', 'Y')
mod <- setModel(
  drift = drift, diffusion = diffusion, solve.variable = vars,
  state.variable = vars, observed.variable = 'Y', xinit = c(0, 0)
)
samp <- setSampling(delta = 0.01, n = 10^3)
trueparam <- list(a = -1.5, b = 0.3, c = 1, sigma = 0.02)

### simulate
yuima <- simulate(mod, sampling = samp, true.parameter = trueparam)
res <- kalmanBucyFilter(
  yuima,
  params = trueparam, mean_init = 0, vcov_init = 0.1,
  delta.vcov.solve = 0.001, are = FALSE
)

### visualize
plot(res, plot_truth = TRUE, level = 0.95)
}

Run the code above in your browser using DataLab