Learn R Programming

bssm (version 2.0.2)

fast_smoother: Kalman Smoothing

Description

Methods for Kalman smoothing of the states. Function fast_smoother computes only smoothed estimates of the states, and function smoother computes also smoothed variances.

Usage

fast_smoother(model, ...)

# S3 method for lineargaussian fast_smoother(model, ...)

smoother(model, ...)

# S3 method for lineargaussian smoother(model, ...)

Value

Matrix containing the smoothed estimates of states, or a list with the smoothed states and the variances.

Arguments

model

Model to be approximated. Should be of class bsm_ng, ar1_ng svm, ssm_ung, or ssm_mng, or ssm_nlg, i.e. non-gaussian or non-linear bssm_model.

...

Ignored.

Details

For non-Gaussian models, the smoothing is based on the approximate Gaussian model.

Examples

Run this code
model <- bsm_lg(Nile, 
  sd_level = tnormal(120, 100, 20, min = 0),
  sd_y = tnormal(50, 50, 25, min = 0),
  a1 = 1000, P1 = 200)
ts.plot(cbind(Nile, fast_smoother(model)), col = 1:2)
model <- bsm_lg(Nile, 
  sd_y = tnormal(120, 100, 20, min = 0),
  sd_level = tnormal(50, 50, 25, min = 0),
  a1 = 1000, P1 = 500^2)

out <- smoother(model)
ts.plot(cbind(Nile, out$alphahat), col = 1:2)
ts.plot(sqrt(out$Vt[1, 1, ]))

Run the code above in your browser using DataLab