What Is the Kalman Filter?

Standard Kalman Filter

In the state-space model framework, the Kalman filter estimates the values of a latent, linear, stochastic, dynamic process based on possibly mismeasured observations. Given distribution assumptions on the uncertainty, the Kalman filter also estimates model parameters via maximum likelihood.

Starting with initial values for states (x0|0), the initial state variance-covariance matrix (P0|0), and initial values for all unknown parameters (θ0), the simple Kalman filter:

  1. Estimates, for t = 1,...,T:

    1. The 1-step-ahead vector of state forecasts vector for period t (x^t|t1) and its variance-covariance matrix (Pt|t1)

    2. The 1-step-ahead vector of observation forecasts for period t (y^t|t1) and its estimated variance-covariance matrix (Vt|t1)

    3. The filtered states for period t (x^t|t) and its estimated variance-covariance matrix (Pt|t)

  2. Feeds the forecasted and filtered estimates into the data likelihood function

    lnp(yT,...,y1)=t=1Tlnϕ(yt;y^t|t1,Vt|t1),

    where ϕ(yt;y^t|t1,Vt|t1) is the multivariate normal probability density function with mean y^t|t1 and variance Vt|t1.

  3. Feeds this procedure into an optimizer to maximize the likelihood with respect to the model parameters.

State Forecasts

s-step-ahead, state forecasts are estimates of the states at period t using all information (for example, the observed responses) up to period ts.

The mt-by-1 vector of 1-step-ahead, state forecasts at period t is xt|t1=E(xt|yt1,...,y1). The estimated vector of state forecasts is

x^t|t1=Atx^t1|t1,

where x^t1|t1 is the mt – 1-by-1 filtered state vector at period t – 1.

At period t, the 1-step-ahead, state forecasts have the variance-covariance matrix

Pt|t1=AtPt1|t1At+BtBt,

wherePt1|t1 is the estimated variance-covariance matrix of the filtered states at period t – 1, given all information up to period t – 1.

The corresponding 1-step-ahead forecasted observation is y^t|t1=Ctx^t|t1,, and its variance-covariance matrix is Vt|t1=Var(yt|yt1,...,y1)=CtPt|t1Ct+DtDt.

In general, the s-step-ahead, forecasted state vector is xt|ts=E(xt|yts,...,y1). The s-step-ahead, vector of state forecasts is

x^t+s|t=(j=t+1t+sAj)xt|t

and the s-step-ahead, forecasted observation vector is

y^t+s|t=Ct+sx^t+s|t.

Filtered States

State forecasts at period t, updated using all information (for example the observed responses) up to period t.

The mt-by-1 vector of filtered states at period t is xt|t=E(xt|yt,...,y1). The estimated vector of filtered states is

x^t|t=x^t|t1+Ktε^t,

where:

  • x^t|t1 is the vector of state forecasts at period t using the observed responses from periods 1 through t – 1.

  • Kt is the mt-by-ht raw Kalman gain matrix for period t.

  • ε^t=ytCtx^t|t1 is the ht-by-1 vector of estimated observation innovations at period t.

In other words, the filtered states at period t are the forecasted states at period t plus an adjustment based on the trustworthiness of the observation. Trustworthy observations have very little corresponding observation innovation variance (for example, the maximum eigenvalue of DtDt is relatively small). Consequently, for a given estimated observation innovation, the term Ktε^t has a higher impact on the values of the filtered states than untrustworthy observations.

At period t, the filtered states have variance-covariance matrix

Pt|t=Pt|t1KtCtPt|t1,

where Pt|t1 is the estimated variance-covariance matrix of the state forecasts at period t, given all information up to period t – 1.

Smoothed States

Smoothed states are estimated states at period t, which are updated using all available information (for example, all of the observed responses).

The mt-by-1 vector of smoothed states at period t is xt|T=E(xt|yT,...,y1). The estimated vector of smoothed states is

x^t|T=x^t|t1+Pt|t1rt,

where:

  • x^t|t1 are the state forecasts at period t using the observed responses from periods 1 to t – 1.

  • Pt|t1 is the estimated variance-covariance matrix of the state forecasts, given all information up to period t – 1.

  • rt=s=tT{[j=ts1(AtKtCt)]CsVs|s11νs}, where,

    • Kt is the mt-by-ht raw Kalman gain matrix for period t.

    • Vt|t1=CtPt|t1Ct+DtDt, which is the estimated variance-covariance matrix of the forecasted observations.

    • νt=yty^t|t1, which is the difference between the observation and its forecast at period t.

Smoothed State Disturbances

Smoothed state disturbances are estimated, state disturbances at period t, which are updated using all available information (for example, all of the observed responses).

The kt-by-1 vector of smoothed, state disturbances at period t is ut|T=E(ut|yT,...,y1). The estimated vector of smoothed, state disturbances is

u^t|T=Btrt,

where rt is the variable in the formula to estimate the smoothed states.

At period t, the smoothed state disturbances have variance-covariance matrix

Ut|T=IBtNtBt,

where Nt is the variable in the formula to estimate the variance-covariance matrix of the smoothed states.

The software computes smoothed estimates using backward recursion of the Kalman filter.

Forecasted Observations

s-step-ahead, forecasted observations are estimates of the observations at period t using all information (for example, the observed responses) up to period ts.

The nt-by-1 vector of 1-step-ahead, forecasted observations at period t is yt|t1=E(yt|yt1,...,y1). The estimated vector of forecasted observations is

y^t|t1=Ctx^t|t1,

where x^t|t1 is the mt-by-1 estimated vector of state forecasts at period t.

At period t, the 1-step-ahead, forecasted observations have variance-covariance matrix

Vt|t1=Var(yt|yt1,...,y1)=CtPt|t1Ct+DtDt.

where Pt|t1 is the estimated variance-covariance matrix of the state forecasts at period t, given all information up to period t – 1.

In general, the s-step-ahead, vector of state forecasts is xt|ts=E(xt|yts,...,y1). The s-step-ahead, forecasted observation vector is

y^t+s|t=Ct+sx^t+s|t.

Smoothed Observation Innovations

Smoothed observation innovations are estimated, observation innovations at period t, which are updated using all available information (for example, all of the observed responses).

The ht-by-1 vector of smoothed, observation innovations at period t is εt|T=E(εt|yT,...,y1). The estimated vector of smoothed, observation innovations is

ε^t=DtVt|t11νtDtKtrt+1,

where:

  • rt and νt are the variables in the formula to estimate the smoothed states.

  • Kt is the mt-by-ht raw Kalman gain matrix for period t.

  • Vt|t1=CtPt|t1Ct+DtDt, which is the estimated variance-covariance matrix of the forecasted observations.

At period t, the smoothed observation innovations have variance-covariance matrix

Et|T=IDt(Vt|t11KtNt+1Kt)Dt.

The software computes smoothed estimates using backward recursion of the Kalman filter.

Kalman Gain

  • The raw Kalman gain is a matrix that indicates how much to weigh the observations during recursions of the Kalman filter.

    The raw Kalman gain is an mt -by-ht matrix computed using

    Kt=Pt|t1Ct(CtPt|t1Ct+DtDt)1,

    where Pt|t1 is the estimated variance-covariance matrix of the state forecasts, given all information up to period t – 1.

    The value of the raw Kalman gain determines how much weight to put on the observations. For a given estimated observation innovation, if the maximum eigenvalue of DtDt is relatively small, then the raw Kalman gain imparts a relatively large weight on the observations. If the maximum eigenvalue of DtDt is relatively large, then the raw Kalman gain imparts a relatively small weight on the observations. Consequently, the filtered states at period t are close to the corresponding state forecasts.

  • Consider obtaining the 1-step-ahead state forecasts for period t + 1 using all information up to period t. The adjusted Kalman gain (Kadj,t) is the amount of weight put on the estimated observation innovation for period t (ε^t) as compared to the 2-step-ahead state forecast (x^t+1|t1).

    That is,

    x^t+1|t=Atx^t|t=Atx^t|t1+AtKtε^t=x^t+1|t1+Kadj,tε^t.

Backward Recursion of the Kalman Filter

Backward recursion of the Kalman filter estimates smoothed states, state disturbances, and observation innovations.

The software estimates the smoothed values by:

  1. Setting rT + 1 = 0, and NT + 1 to an mT-by-mT matrix of 0s

  2. For t = T,...,1, it recursively computes:

    1. rt (see Smoothed States)

    2. x^t|T, which is the matrix of smoothed states

    3. Nt (see Smoothed States)

    4. Pt|T, which is the estimated variance-covariance matrix of the smoothed states

    5. u^t|T, which is the matrix of smoothed state disturbances

    6. Ut|T, which is the estimated variance-covariance matrix of the smoothed state disturbances

    7. ε^t|T, which is the matrix of smoothed observation innovations

    8. Et|T, which is the estimated variance-covariance matrix of the smoothed observation innovations

Diffuse Kalman Filter

Consider a state-space model written so that the m diffuse states (xd) are segregated from the n stationary states (xs). That is, the moments of the initial distributions are

μ0=[μd0μs0]andΣ0=[Σd000Σs0].

  • μd0 is an m-vector of zeros

  • μs0 is an n-vector of real numbers

  • Σd0 = κIm, where Im is the m-by-m identity matrix and κ is a positive real number.

  • Σs0 is an n-by-n positive definite matrix.

  • The diffuse states are uncorrelated with each other and the stationary states.

One way to analyze such a model is to set κ to a relatively large, positive real number, and then implement the standard Kalman filter (see ssm). This treatment is an approximation to an analysis that treats the diffuse states as if their initial state covariance approaches infinity.

The diffuse Kalman filter or exact-initial Kalman filter [35] treats the diffuse states by taking κ to ∞. The diffuse Kalman filter filters in two stages: the first stage initializes the model so that it can subsequently be filtered using the standard Kalman filter, which is the second stage. The initialization stage mirrors the standard Kalman filter. It sets all initial filtered states to zero, and then augments that vector of initial filtered states with the identity matrix, which composes an (m + n)-by-(m + n + 1) matrix. After a sufficient number of periods, the precision matrices become nonsingular. That is, the diffuse Kalman filter uses enough periods at the beginning of the series to initialize the model. You can consider this period as presample data.

The second stage commences when the precision matrices are nonsingular. Specifically, the initialization stage returns a vector of filtered states and their precision matrix. Then, the standard Kalman filter uses those estimates and the remaining data to filter, smooth, and estimate parameters. For more details, see dssm and [35], Sec. 5.2.

References

[1] Durbin J., and S. J. Koopman. Time Series Analysis by State Space Methods. 2nd ed. Oxford: Oxford University Press, 2012.

See Also

| | | | | | | | |

Related Topics