wex {wex}R Documentation

Exact observation weights for the Kalman filter and smoother.

Description

This function computes the exact observation weights for the Kalman filter and smoother, as described by Koopman and Harvey (2003). The implementation of wex builds upon the existing FKF package (see: https://CRAN.R-project.org/package=FKF).

Usage

wex(a0 = NULL, P0 = NULL, Tt, Zt, HHt, GGt, yt, t)

Arguments

a0

A vector giving the initial value/estimation of the state variable. By default is set to zero.

P0

A matrix giving the variance of a0. By default is a diagonal matrix of 10^6.

Tt

An array giving the factor of the transition equation (see Details).

Zt

An array giving the factor of the measurement equation (see Details).

HHt

An array giving the variance of the innovations of the transition equation (see Details).

GGt

An array giving the variance of the disturbances of the measurement equation (see Details).

yt

An n \times d matrix, where d is the dimension and n is the number of observations. matrix containing the observations. “NA”-values are allowed (see Details).

t

An observation index for which the weights are returned.

Details

State space form

\alpha_{t+1} = T_t \alpha_t + H_t \eta_t,

y_t = Z_t \alpha_t + G_t \epsilon_t,

where y_t represents the observed data (possibly with NA's), and \alpha_t is the state vector.

Value

Weight matrices for filtering (Wt) and smoothing (WtT).

References

Koopman, S. J., & Harvey, A. (2003). Computing observation weights for signal extraction and filtering. Journal of Economic Dynamics and Control, 27(7), 1317-1333.

Examples


# Decompose a local level model (Nile data set)
data(Nile)
y <- Nile
wts <- wex(Tt=matrix(1),
Zt=matrix(1),
HHt = matrix(1385.066),
GGt = matrix(15124.13),
yt = t(y),
t=50)






[Package wex version 0.1.0 Index]