Learn R Programming

bssm (version 1.1.7-1)

kfilter: Kalman Filtering

Description

Function kfilter runs the Kalman filter for the given model, and returns the filtered estimates and one-step-ahead predictions of the states \(\alpha_t\) given the data up to time \(t\).

Usage

kfilter(model, ...)

# S3 method for gaussian kfilter(model, ...)

# S3 method for nongaussian kfilter(model, ...)

Arguments

model

Model of class gaussian, nongaussian or ssm_nlg.

...

Ignored.

Value

List containing the log-likelihood (approximate in non-Gaussian case), one-step-ahead predictions at and filtered estimates att of states, and the corresponding variances Pt and Ptt.

Details

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

See Also

bootstrap_filter

Examples

Run this code
# NOT RUN {
x <- cumsum(rnorm(20))
y <- x + rnorm(20, sd = 0.1)
model <- bsm_lg(y, sd_level = 1, sd_y = 0.1)
ts.plot(cbind(y, x, kfilter(model)$att), col = 1:3)
# }

Run the code above in your browser using DataLab