Name

kalman — Kalman filter estimation

CALLING SEQUENCE

[rkalman]=kalman(func,y,x,z,F,param,varargin)

PARAMETERS

Input

• func = the function which transforms the parameters into the matrix of variances (Q and R)

• y = (nobs x 1) dependent variable vector

• x = (nobs x 1) explanatory variable matrix

• z = (nxl) data matrix of exogenous variables (or [] if there are no exogenous variables in the model) .TP

• F = the transfer matrix

• param = a vector of parameters (sqrt of variances)

• varargin = optional arguments which can be:

 - 'priorb0=x' where x is (k x 1) vector with prior b0 values (default = zeros(k,1), diffuse)

 - 'priorv0=x' where x = (k x k) matrix with prior variance for Q (default = eye(k)*1e+5, a diffuse prior)

 - 'meth=x' where x is either 'maxlik' (default) or 'optim' according to the optimization program used

 - any option to maxlik (see maxlik() for a list)

Output

• rkalman = a results tlist with

  - rkalman('meth') = 'kalman'

  - rkalman('Q') = estimated Q

  - rkalman('R') = estimated R

  - rkalman('priorb0') = B(0/0)

  - rkalman('priorv0') = sigma(0/0)

  - rkalman('betat') = B(t/t)

  - rkalman('betaf') = B(t/t-1)

  - rkalman('betas') = B(t/T)

  - rkalman('sigmatt') = sigma(t/t)

  - rkalman('sigmatf') = sigma(t/t-1)

  - rkalman('sigmats') = sigma(t/T)

  - rkalman('param') = estimated parameters

  - rkalman('vcov') = variance-covariance matrix of estimated parameters

  - rkalman('tstat') = Student's t of estimated parameters

  - rkalman('y') = y

  - rkalman('x') = x

  - rkalman('yhat') = X(t)*B(t)

  - rkalman('resid') = y-X*B(t)

  - rkalman('like') = log-likelihood

  - rkalman('nobs') = # of observations

  - rkalman('nvar') = # of exogenous variables

DESCRIPTION

Maximum likelihood estimation of a kalman model: y(t) = X(t)*B(t) + Z(t)*A + e(t), e(t) = N(0,R) B(t) = Z(t) .TP B(t-1) + v(t), v(t) = N(0,Q)

EXAMPLE

rtvp=kalman(grocer_func,grocer_y,grocer_x,grocer_ik,grocer_param,'priorb0=grocer_priorb0','priorv0=grocer_priorv0','meth=grocer_optmeth',varargin(:))
// This example is taken from tvp. Here grocer_func is one of the 4 following cases: 1) '[Q,R]=tvp_param1(grocer_param)' 2) '[Q,R]=tvp_param1a(grocer_param)' 3) '[Q,R,grocer_priorb0]=tvp_param2(param)' 4) '[Q,R,grocer_priorb0]=tvp_param2a(param)'; grocer_y is the vector of endogenous variables, grocer_x the matrix of exogenous variables; grocer_ik is the (kxk) identity matrix; grocer_param is a vector of starting values, either given b the user or calculated as the ols regression of y on x; grocer_priorb0, grocer_priorv0 and grocer_optmeth are either the values given by the user or the default values; lastly, varargin are the option for maxlik, if any, given by he user. 

               

AUTHOR

Eric Dubois 2002