Kalman filter estimation
[rkalman]=kalman(func,y,x,z,F,param,arg1,...,argn)
* 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)
* argi = 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)
- 'optfunc=optim' if the user wants to use the optim optimisation function (default: optimg)
- 'opt_nelmead=crit,nitermax' with crit the value of the convergence criterion in the Nelder-Meade optimisation function and nitermax the maximum number of iterations (default = 'opt_nelmead=2*%eps,1000')
- 'opt_optim=opts' where opts are options for optim that can be entered after the starting value of the parameters (default = 'opt_optim=,''ar'',1e6,1e6'')
- 'opt_convg=val' where val is the threshold on gradient norm (default = 'opt_convg=1e-5')
* 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
y(t) = X(t)*B(t) + Z(t)*A + e(t), e(t) = N(0,R)
B(t) = Z(t) * B(t-1) + v(t), v(t) = N(0,Q)