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

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

Time varying model with kalman filter

Postby Aktar » Thu May 21, 2009 6:15 am

Hi

i want to buil a state space model with time varying coefficient ( return to normailty model so AR (1) process in the box of stochastic regressors ?)

I specify for exemple

Code: Select all

@signal r = sv1*er + [var = exp(c(1))] @state sv1 = c(3) + c(4)*sv1(-1) + [var = exp(c(2))]
when i proceed to the estimation i have std error = 0 z-statistics = NA and prob = 0

WHY ? it is a probleme of variance or covariance matrix ? someone have a response ?

To conclude How i can specify initial condition and make the kalman filter ?

im student and eviews is new for me. Thanks for your help

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Time varying model with kalman filter

Postby EViews Glenn » Thu May 21, 2009 6:28 am

Sounds like you have a problem with singularity. Are there any messages about singularity in the output? What starting values did you use? What does the gradients view look like (View/Gradients)?

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

Re: Time varying model with kalman filter

Postby Aktar » Thu May 21, 2009 6:37 am

i don't know how i can specify initial value

but i want take Beta 0/0 = Beta (mean vector of Bt coefficient) and var-cov matrix 0/0 = Identity matrix

for gradient, i don't know how i can interpretate it... it's like that

Coefficient Sum Mean Newton Dir.

C(1) 1.63E+263 1.61E+261 0.000000
C(2) 0.000000 0.000000 0.000000
C(3) -2.5E+272 -2.5E+270 0.000000
C(4) 1.87E+268 1.85E+266 0.000000

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

Re: Time varying model with kalman filter

Postby Aktar » Thu May 21, 2009 8:02 am

yes i have this message " WARNING: Singular covariance - coefficients are not unique"

Coefficient Std. Error z-Statistic Prob.

C(1) 0.000000 NA NA NA
C(2) 0.000000 NA NA NA
C(3) 0.000000 NA NA NA
C(4) 0.000000 NA NA NA
C(5) 0.000000 NA NA NA
C(6) 0.000000 NA NA NA
C(7) 0.000000 NA NA NA

Can you explain what is the problem ?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Time varying model with kalman filter

Postby EViews Glenn » Thu May 21, 2009 9:26 am

Your starting values are so bad that we can't find a valid step to start the estimation procedure. You are starting with all of your C values equal to zero, which is equivalent to settin gthe variances to 1 and the remaining coefficients to zero.

You can fiddle with the starting values by putting various things in the C vector prior to estimation.

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

Re: Time varying model with kalman filter

Postby Aktar » Thu May 21, 2009 10:15 am

ok thanks ...

What are the C values and how i can modify the C vector ? it is in the autospec, variance specification ?
in manual how i can specify myself ?

and can you explain me how i must interpretate gradients

thanks a lot

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Time varying model with kalman filter

Postby EViews Gareth » Thu May 21, 2009 12:19 pm

The C vector is an object in your workfile. Its the little icon with a beta symbol in it, called "C". You can double click on it to open it up and modify.

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

Re: Time varying model with kalman filter

Postby Aktar » Fri May 22, 2009 8:27 am

OK thanks

In c vector we can specify starting values. But instead of specify directly starting values i can enter command for define initial conditions ?
normally i define my initial condition and i take the starting value for make the kalman filter ?

I want specify for example a initial state vector with the the mean Beta and an identity matrix for the variance

so i enter :

Code: Select all

@signal illiq = sv1*libor + sv2*abcp + [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))] vector(2) svec0 svec0.fill 0, 0 matrix (2,2) svar0 svar0.fill(b=c) 1, 0, 0, 1 @mprior svec0 @vprior svar0
However i have a problem of syntax... i have the message

Code: Select all

syntax error in"vector(2) svec0"
and if i try with another methods like create vector and matrix with objects/new objects/matrix-vecor-coef i have also a problem because a message tells me that my matrix is not a sym object... even if i declare for example

Code: Select all

sym matrix01
like that :

Code: Select all

sym matrix01 @mprior svec0 @vprior svar0
with my matrix and my vecto that have created in my workfile

THANKS A LOT :wink: :wink:

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Time varying model with kalman filter

Postby EViews Glenn » Fri May 22, 2009 9:01 am

There are two sets of "starting values" here. The first are the coefficient starting values for the variance estimation. Those are the ones that you will set using the C vector.

The second are the initial conditions for the state vector and state covariance. As the error messages indicate, you need to provide a sym matrix object to your @vprior. The errors you are getting are because you have not done so.

First make certain that you delete your existing MATRIX01 since you have already created it as a matrix object instead of a sym. Then create the sym using

Code: Select all

sym matrix01 = @identity(2)
Note that construction of this matrix should not be part of the sspace specification, but rather should be done in EViews itself.

Lastly, use the

Code: Select all

@vprior matrix01
inside your state space specification.

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

Re: Time varying model with kalman filter

Postby Aktar » Fri May 22, 2009 9:08 am

ok thank you very much

but how and where i can specify

Code: Select all

sym matrix01 = @identity(2)
i must create an object or what ?

thank you

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Time varying model with kalman filter

Postby EViews Glenn » Fri May 22, 2009 11:39 am

Object/New Object

or even easier, just type the line in the command window.

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

Re: Time varying model with kalman filter

Postby Aktar » Fri May 22, 2009 1:56 pm

Ok thank you it work

When i specify my initial condition like

state vector
(0)
(0)

and state variance
(1 0)
(0 1)

i find this estimation :

Coefficient Std. Error z-Statistic Prob.

C(1) -8.172025 NA NA NA
C(2) -31.57847 NA NA NA
C(3) 0.201469 NA NA NA
C(4) -0.261210 NA NA NA
C(5) -81.02884 NA NA NA
C(6) -0.231684 NA NA NA
C(7) -0.282587 NA NA NA


My starting value are too bad...and i have the message "WARNING: Singular covariance - coefficients are not unique"

So the probleme come from my initial condition ? or i just must change starting value ?
And when i have good starting value i can make the kalman filter ?

I don't very well understand what's is the starting values because when i proceed to the estimation i have in my C vector just the starting value and after, in the following boxes i have 0 everywhere. How i can know Which are the good starting values ?

and i don't understand why in my C vector i have just starting values and 0

I know that it is a lot of questions but it is for my thesis of master degree thank you very much if you can respond,
I am a little lost with eviews for this kind of model.

I have many other issues but i will see after.

thank you for availability of the member it's very useful

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Time varying model with kalman filter

Postby EViews Glenn » Fri May 22, 2009 3:34 pm

There's no general rule for setting the starting values, but as I said, your problems are in the C vector not in the initial conditions for the states...

At the moment, you are initializing your variances to whatever is in the C vector. That doesn't appear to be a very good set of starting values. Note in particular that your state innovation variances are very close to zero (exp(c(2)) and exp(c(5))

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

Re: Time varying model with kalman filter

Postby Aktar » Sat May 23, 2009 3:42 am

ok i choose starting value up to have significant coefficient... and after when i have the good starting value i can make kalman filter for have the estimation of sv1 and sv2 ?

In starting value, do you think that i just must change c(2) and c(5) or i must change all the coefficents ? eveni there is no rules for starting values what is the most appropriate globally ?

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

Re: Time varying model with kalman filter

Postby Aktar » Sat May 23, 2009 6:33 am

Coefficient Std. Error z-Statistic Prob.

C(1) -8.311964 0.129936 -63.96987 0.0000
C(2) -10.23589 1.348863 -7.588529 0.0000
C(3) 0.016756 0.004943 3.389727 0.0007
C(4) 0.911299 0.031677 28.76876 0.0000
C(5) -28.93186 1.61E+08 -1.79E-07 1.0000
C(6) -0.032780 0.006146 -5.333850 0.0000
C(7) 0.851091 0.017376 48.98100 0.0000

I find something like this but i don't know how i can have better results... but i don't arrive to have a significativ coefficient for the variance of the state vector... i don't understand difference between intial condition and starting values

thank you


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests