RATS 11
RATS 11

KFSET (options)  list of covariance matrices

# < supp. card >innovation variances (with VARIANCE=KNOWN, CONSTANT and no VECTOR)

# < supp. card >series with equation variances (with VARIANCE=KNOWN AND NOCONSTANT)

 

KFSET is a subcommand of SYSTEM which describes the setup of the Kalman filter that you want to apply to the equations. KFSET, KALMAN, and TVARYING are used specifically for estimating the coefficients of a linear model. The instruction DLM is a more general instruction which can apply the Kalman filter more widely, such as for solving and estimating state-space models.

Parameters

list of matrices

List of SYMMETRIC arrays which are to hold the covariance matrices of the coefficients (states). You can use the option NAMES as an alternative to listing these explicitly.

 

There should be one array for each equation in the system, except if the system is a simple OLS vector autoregression, in which case you only need one array.

 

If you do not need access to the covariance matrices (either to\ set them or to examine them), you can omit the list of matrices. RATS will store all information internally.

Technical Information

RATS analyzes the equations in the system individually. The following model is used for each equation:

The coefficient vector \(\bf{\beta}_t\)  is the vector of “states” at time t.

The measurement equation is \({y_t} = {{\bf{X}}_t}{\bf{\beta }_t} + {u_t}\), where the variance of \({u_t}\) is \({n_t}\).

The state vector follows the process:\({\bf{\beta }_t} = {\bf{\beta }_{t - 1}} + {{\bf{v}}_t}\) , with \({\rm{Var}}\left( {{{\bf{v}}_t}} \right) = {{\bf{M}}_t}\).

\({u_t}\) and \({\bf{v}_t}\) are independent.

 

Let \({\bf{\beta} _{t|t}}\) be the estimates of \(\bf{\beta}_t\) using information through t, and let the covariance matrix of \({\bf{\beta} _{t|t}}\) be written \({\bf{\Sigma }_t}\) . What KFSET provides are

1.The \({\bf{\Sigma }_t}\)  matrices (one for each equation)

2.The \({n_t}\). The options VARIANCE, CONSTANT, VECTOR and the supplementary cards are used to allow you to handle both situations where \({n_t}\) is constant over time, and those where it changes.

Options

VARIANCE=[CONCENTRATED]/KNOWN

[CONSTANT]/NOCONSTANT

V=VECTOR supplying equation variances [unused] (with VARIANCE=KNOWN,CONSTANT only)

Use these options for setting the variances of the measurement equation errors. Note that constant variances are provided in a VECTOR. This is done because a SYSTEM can, and often does, have several equations. If you’re analyzing a single equation, just use a vector with dimension one, or the notation ||variance||. The VARIANCE option replaces the SCALE option used in previous versions.

 

LIKELIHOOD=RECTANGULAR matrix

This allows computation (by KALMAN instructions) of a pseudo-likelihood function for Kalman filter estimates stored in the array. See Doan, Litterman and Sims (1984), page 10 for more information.

 

A subsequent KALMAN instruction will store the likelihood functions in this array.

 

NAMES="base for array names"

This is an alternative to using the list of matrices parameter. When you use NAMES, KFSET forms names formed by appending the numbers 1,2,3,etc. to the base label you supply. That is, if you use NAMES="COVMAT", KFSET will create COVMAT1, COVMAT2, etc.; as many as are needed. NAMES is largely obsolete, because you now use a VECTOR of SYMMETRIC arrays for the list of matrices.

Description

KFSET uses the list of matrices in two ways:
 

If you execute KALMAN without an ESTIMATE, list of matrices supplies the initial estimates of the covariance matrices of the coefficients (states). You have to dimension the array(s) and set them before you can do the KALMAN.
 

If you do execute an ESTIMATE, RATS fills the list of matrices with the estimated covariance matrices. For this use, you do not need to dimension the arrays because ESTIMATE does it for you.

 

If you are using KALMAN without ESTIMATE, the initial coefficients also need to be set. This is usually done with the ASSOCIATE instruction.

 

If you want time-varying parameters (\({{\bf{M}}_t}\) non-zero), you need to use TVARYING as well as KFSET.

Notes

If you want to write a single set of code which can handle VARs of various sizes, we recommend that you use a VECTOR[SYMMETRIC] in place of a list. For instance,

 

dec vector[symmetric]  kfs(neqn)

kfset kfs

 

makes KFS(1), KFS(2),..., KFS(NEQN) the list of matrices.

Equation Variances

There are several options which control the behavior of the measurement equation variances. Choose the method which is correct for your assumptions:
 

 

Constant over time and unknown

 

Use the option VARIANCE=CONCENTRATED (default). RATS computes new estimates for the variances whenever you request output from ESTIMATE or KALMAN. If you are using time-varying parameters (\({{\bf{M}}_t}\) is non-zero), you should use one of the VARIANCE=KNOWN alternatives.

 

If the system is a vector autoregression without a prior, it is possible to list just one array on KFSET since all equations have the same \({\left( {{\bf{X'}}{\kern 1pt} {\bf{X}}} \right)^{ - 1}}\) matrix. See the example below.

 

 

Constant over time and known

 

Use VARIANCE=KNOWN with CONSTANT. You can supply the values in one of two ways:
 

with the option V=VECTOR of variances

with a supplementary card

 

 

Changing over time

 

Use VARIANCE=KNOWN and NOCONSTANT, and include a supplementary card which lists series whose values are the desired variances.

Examples

system(model=rmpy)

variables  cpr m1 ppi ip

lags 1 to 12

kfset xxsys

end(system)

estimate 1948:1 2010:12

 

uses KFSET to obtain the \(\left( {{\bf{X'}}{\kern 1pt} {\bf{X}}} \right)^{ - 1} \) matrix from the estimation of a VAR. Since there is no prior, we only list one array on KFSET.

 

 

equation kfeq y

# constant x1 x2

system kfeq

kfset(variances=known,constant) xxmat

# .01

tvarying tvmat

end(system)

dimension xxmat(3,3) tvmat(3,3)

 

Time varying coefficients with \(n_t  = .01\). You need to set the initial values of XXMAT, TVMAT and the coefficients of KFEQ before you can use KALMAN.

 


Copyright © 2025 Thomas A. Doan