# Dynare and Unit root

Hello,

Could you explain some properties of dynare which are concern unit root?

As I understand, when unit root is declared, dynare use Kalman filter with high variance. But, first observation of unit root variable has infinite variance, as I understand. So, it creates distortion. Why does dynare not use Kalman filter with gradual initialization (I’m not familiar with literature, so name could be incorrect)?
MichelJuillard have written that there are some problems, but I see only computational problems (gradual initialization could make Kalman filter slowly).

Another question is about declaring of unit rot variables. How does it influence the result? Is it possible to understand which variables has unit root from parameters values? For example, if X(t)=A*X(t-1)+er(t), then variables corresponding to eigenvalues=1 would be nonstationary.

Thank you for response.

I’m not sure what you mean by gradual initialization.

We are currently working on fixing the diffuse filter (Durban and Koopman) for the case of cointegrated variables.

I hope to have good news soon

Best

Michel

I’m not familiar with literature. Kalman filter with gradual initialization is simple Kalman filter where we don’t initiate unit root variables (We don’t write that they have some expectation and variance). When we have new observation we divide it into two parts. First part is depended on uninitialized variables. Second part is independed on uninitialized variables. We use first part for initialization of unit root variables line combination. After that we use second part for calculation of likelihood and calculation of conditional expectation and variance.
I tried to realize this algorithm yesterday. But matrix of eigenvectors has bad conditional number (about 10^20). It creates some inaccuracy. But I believe that I’ll finished realization today for case of fixed dependence of observation from state variables.

I’m attaching m-file with realization of Kalman filter which could be used with dynare and unit root variables. I have to use observation by one. Otherwise there were some problem with variance of observations (it isn’t positive define). That’s why code is very slow. It should be noted that code is checked only on a few examples. So, there are probably misprints. But I believe that it’s possible to understand the idea of Kalman filter with gradual initialization.

Sorry for Russian comments at code.
var_unobserved_likelihood_Integrated.m (5.38 KB)