Time varying model with kalman filter

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: Time varying model with kalman filter

Postby startz » Sat May 23, 2009 7:07 am

Your model assumes the time-varying coefficients are uncorrelated. You might see what happens if you allow for a covariance term.

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Sat May 23, 2009 7:32 am

yes because my state covariance in initial condition is an identity matrix... i have read that for this kind of model (return to normality).

You think it is relevate to make this kind of model ?

Code: Select all

@signal r = sv1*abcp + sv2*dif_inf + sv3*dif_tx + sv4*gdpre_rate + sv5*libor + sv6*ratio_cap_gdp + sv7*stan_poo_vol + sv8*swap + sv9*var_re + [var = exp(c(1))] @state sv1 = c(3) + c(4)*sv1(-1) + [var = exp(c(2))] @state sv2 = c(6) + c(7)*sv2(-1) + [var = exp(c(5))] @state sv3 = c(9) + c(10)*sv3(-1) + [var = exp(c(8))] @state sv4 = c(12) + c(13)*sv4(-1) + [var = exp(c(11))] @state sv5 = c(15) + c(16)*sv5(-1) + [var = exp(c(14))] @state sv6 = c(18) + c(19)*sv6(-1) + [var = exp(c(17))] @state sv7 = c(21) + c(22)*sv7(-1) + [var = exp(c(20))] @state sv8 = c(24) + c(25)*sv8(-1) + [var = exp(c(23))] @state sv9 = c(27) + c(28)*sv9(-1) + [var = exp(c(26))]
or it is too difficult ?

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: Time varying model with kalman filter

Postby startz » Sat May 23, 2009 7:38 am

yes because my state covariance in initial condition is an identity matrix... i have read that for this kind of model (return to normality).

You think it is relevate to make this kind of model ?

Code: Select all

@signal r = sv1*abcp + sv2*dif_inf + sv3*dif_tx + sv4*gdpre_rate + sv5*libor + sv6*ratio_cap_gdp + sv7*stan_poo_vol + sv8*swap + sv9*var_re + [var = exp(c(1))] @state sv1 = c(3) + c(4)*sv1(-1) + [var = exp(c(2))] @state sv2 = c(6) + c(7)*sv2(-1) + [var = exp(c(5))] @state sv3 = c(9) + c(10)*sv3(-1) + [var = exp(c(8))] @state sv4 = c(12) + c(13)*sv4(-1) + [var = exp(c(11))] @state sv5 = c(15) + c(16)*sv5(-1) + [var = exp(c(14))] @state sv6 = c(18) + c(19)*sv6(-1) + [var = exp(c(17))] @state sv7 = c(21) + c(22)*sv7(-1) + [var = exp(c(20))] @state sv8 = c(24) + c(25)*sv8(-1) + [var = exp(c(23))] @state sv9 = c(27) + c(28)*sv9(-1) + [var = exp(c(26))]
or it is too difficult ?
Why don't you start by running least squares. You can use the estimated coefficients as starting values of the state vector and the estimated variance-covariance matrix as starting values for the relevant parameters.

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Mon Jun 01, 2009 12:14 pm

ok thanks but if i want take coefficients and covariance matrix i must have stationary variable when i run OLS ? and i must take variable in first difference in my state space models if my variables are not stationary in level ?

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Mon Jun 01, 2009 2:31 pm

i have test with ols. I have selected my significant variable.

so for this model

Code: Select all

@signal illiq = sv1*libor + sv2*abcp + sv3*stan_poo_vol + sv4*gdpno_rate + sv5*ratio_cap_gdp + sv6*dif_tx + [var = exp(c(1))] @state sv1 = c(3) + c(4)*sv1(-1) + [var = exp(c(2))] @state sv2 = c(6) + c(7)*sv2(-1) + [var = exp(c(5))] @state sv3 = c(9) + c(10)*sv3(-1) + [var = exp(c(8))] @state sv4 = c(12) + c(13)*sv4(-1) + [var = exp(c(11))] @state sv5 = c(15) + c(16)*sv5(-1) + [var = exp(c(14))] @state sv6 = c(18) + c(19)*sv6(-1) + [var = exp(c(17))] @mprior vector01 @vprior matrix01
i watch coefficients in my ols estimation

Variable Coefficient Std. Error t-Statistic Prob.

LIBOR 0.082613 0.033439 2.470523 0.0153
ABCP -0.106511 0.035073 -3.036818 0.0031
STAN_POO_VOL 63.39752 16.12677 3.931197 0.0002
GDPNO_RATE -0.019445 0.004872 -3.991159 0.0001
RATIO_CAP_GDP 0.025948 0.008997 2.884196 0.0049
DIF_TX 0.002885 0.001013 2.849191 0.0054


and i replace in my C vector, starting value c(4) c(7) c(10) c(13) by the great coefficient

after i watch the covariance matrix in my estimation and i take variance (diagonal) and i replace c(2) c(5) c(8) c(11) c(14) c(17)

the problem is that i have the same message WARNING: Singular covariance - coefficients are not unique

what are the problem, i don't understand :( ... what are the first thing that i must see when i want build a time varying model with kalman filter in eviews ??

thanks for your help and sorry if my question are naive. :roll:

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Time varying model with kalman filter

Postby trubador » Mon Jun 01, 2009 11:10 pm

Estimating a model with Kalman filter is not an easy task and you should not expect to obtain feasible results each time you run it. As you can understand from Gareth's, Glenn's and Startz' suggestions, there may be plenty of reasons why your model does not produce the desired output. State space models are quite flexible and therefore minor changes may have important impacts on the results. You should accurately design your model and properly define the dynamics of the system. For instance, you may consider adding or dropping variables, increasing the sample size, adjusting for scale differences, allowing covariances among some error terms, etc. You are trying to estimate 6 unobserved variables along with 19 unknown coefficients, which may be difficult for the model to converge. You should be very careful about supplying the initial conditions for state vectors, since it would do more harm than good if you ill-defined the values. Even if you do everything on your part, it is sometimes just a process of trial and error.

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Tue Jun 02, 2009 4:49 am

ok thanks but i have a problem with eviews command.

when i have define my state space models... i choose starting values ect. and i run it, and after i go in procs and i make the kalman filter ?

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Tue Jun 02, 2009 10:35 am

Can you just explain me how i must do in eviews 4 for estimate time varying model with kalman filter please (just for know commande and different step with this softwar)

thanks and sorry I'm stressed because I am afraid of not getting

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Time varying model with kalman filter

Postby trubador » Tue Jun 02, 2009 11:18 am

There is nothing wrong with your command. I guess you are using "Proc/Define State Space..." option, which helps you build your model easily. When you estimate this model, it first estimates the unknown coefficient values and then implements kalman filter algorithm by default. So you do not have to do anything else for that matter. I do not see anything obviously false or structurally incorrect in your model. You can try several other things as I mentioned in my previous post.

Aktar
Posts: 74
Joined: Thu May 21, 2009 5:08 am

Re: Time varying model with kalman filter

Postby Aktar » Thu Jun 04, 2009 7:18 am

how i can allowing covariances among some error terms in eviews please ?

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Time varying model with kalman filter

Postby trubador » Fri Jun 05, 2009 12:30 am

Let's say you want to allow correlation between the error terms of first and fourth state equations:

Code: Select all

... @state sv1 = c(3) + c(4)*sv1(-1) + [ename=e1, var=exp(c(2))] ... ... @state sv4 = c(12) + c(13)*sv4(-1) + [ename=e4, var = exp(c(11))] ... ... @evar cov(e1, e4) = c(20)
At this point, I think it would be in your best interest if you took a glance at the related chapter in EViews manual once again...


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests