Kalman filter and NAIRU, declaring space/state

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 Moderator, EViews Gareth

Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Wed Feb 15, 2012 9:29 pm

Hi
I'm replicating a paper, which modelled the NAIRU like this:
Image
equation 1 says output is equal to a tendency, h, and a cycle, x. Eq 2 says the tendency is explained by a tendency also, g, and a random error.
Eq 3 explains that tendency g. Eq4 says the cyclical component of output is defined by an AR(2). Eq 5,6,7 have similar explanations. Forget equation 8, i made a mistake repeating that one.
So, i'm a bit lost declaring the model under Kalman filter
The first matrix is the state, the second one the transition or signal
Image
So how i do declare the state and space under Eviews? I've read example but nothing useful. Multiplying the matrix that generates the states i get

@state y=h+x
@state u=c(1)*x+ c(2)*x(-1)+ c(3)*x(-2)+ s+[var = exp(c(4))]

@signal h=h(-1)+g(-1)+[var = exp(c(5))]
@signal x=c(6) x(-1)+c(7) x(-2)+[var = exp(c(4))]
@signal x(1)=x(-1) //@signal sv2=sv1(-1)? i don't know how to express this correctly.
@signal s=s(-1)+[var = exp(c(8))]
@signal g=g(-1)+[var = exp(c(9))]

Please, give some help. I'm not used to work with Kalman filter. Thanks in advance for your time and interest.
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby trubador on Thu Feb 16, 2012 12:57 am

There are plenty of examples in the forum. Besides, you should read "Specifying a State Space Model in EViews" section in the manual, before going forward.

Higher order lag specifications can be handled through state augmentation. In your case, AR(2) process can be implemented as follows:

Code: Select all
@state x = c(6)*x(-1) + c(7)*x1(-1) + [var = exp(c(8))]
@state x1 = x(-1)
trubador
Did you use forum search?
 
Posts: 1024
Joined: Thu Nov 20, 2008 12:04 pm

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Thu Feb 16, 2012 2:20 am

Thanks, i'll give a try to what you wrote.
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Thu Feb 16, 2012 9:20 pm

When i run this state/space specification
Code: Select all
@state y=h+x
@state u=c(1)*x+ c(2)*x(-1)+ c(3)*x(-2)+ s+[var = exp(c(4))]
@state x=c(5)*x(-1)+c(6)*x1(-1)+[var = exp(c(7))]
@state x1=x(-1)

@signal h=h(-1)+g(-1)+[var = exp(c(8))]
@signal s=s(-1)+[var = exp(c(9))]
@signal g=g(-1)+[var = exp(c(10))]


i get the following error
"H is not defined"
I uploaded the wfl where i'm working on. Help me please.
Attachments
datos kalman.wf1
Working file
(17.69 KiB) Downloaded 80 times
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby startz on Thu Feb 16, 2012 9:50 pm

You need data for the signal variables. You don't have any for h.
startz
Non-normality and collinearity are NOT problems!
 
Posts: 2173
Joined: Wed Sep 17, 2008 2:25 pm

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Thu Feb 16, 2012 10:05 pm

But in the paper, the author says h and x are unknown. He clearly says those equations represent states. But under eviews, they should represent @signal? I want to declare i really don't know Kalman implementation. The only data i have is Y and U, which are gdp and unemployment. The paper illustrates the other values, like tendency and cycle. The fist equation shows gdp=h(tendency)+x(cycle). The rest of the equations are similar. That's why i don't have more data. I'm not sure if i express myself in the right way.
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby trubador on Fri Feb 17, 2012 12:15 am

Your specification does not correctly match that of authors. You should have only two signal equations (i.e. y and u), the rest will be state equations.
Last edited by trubador on Fri Feb 17, 2012 1:08 am, edited 1 time in total.
trubador
Did you use forum search?
 
Posts: 1024
Joined: Thu Nov 20, 2008 12:04 pm

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Fri Feb 17, 2012 12:38 am

Code: Select all
@signal pib=h+x
@signal u=c(1)*x+ c(2)*x(-1)+ c(3)*x1(-1)+ s+[var = exp(c(4))]
@state h=h(-1)+g(-1)+[var = exp(c(5))]
@state x=c(6)*x(-1)+c(7)*x1(-1)+[var = exp(c(8))]
@state x1=x(-1)
@state s=s(-1)+[var = exp(c(9))]
@state g=g(-1)+[var = exp(c(10))]

It didn't work:
Invalid lags or leads for state variables in signal equation
"@signal u=c(1)*x+ c(2)*x(-1)+ c(3)*x1(-1)+ s+[var = exp(c(4))]"


From the theory, i recall that an estimation like the one i'm trying, i'd should give starting values for the h,x,s,g,and so and also for variances. That's what i remember, am i right?
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby trubador on Fri Feb 17, 2012 1:41 am

The following specification should work:

Code: Select all
@signal pib=h+x
@signal u=c(1)*x+ c(2)*x1+ c(3)*x2+ s+[var = exp(c(4))]

@state h=h(-1)+g(-1)+[var = exp(c(5))]
@state x=c(6)*x(-1)+c(7)*x1(-1)+[var = exp(c(8))]
@state x1=x(-1)
@state x2 = x1(-1)
@state s=s(-1)+[var = exp(c(9))]
@state g=g(-1)+[var = exp(c(10))]


EViews handles the inital conditions by default. However, when it is not possible to solve for the initial conditions, state levels are initialized to zero and state variances are initialized to a very large number to represent the great uncertainty surrounding the initial values (i.e. diffuse priors). If you want to use your own values, you should create appropriate vectors/matrices and supply them via @mprior and/or @vprior. Initialization of coefficients (e.g. c(1), c(2), ...), on the other hand, can be handled by param command.

Given the complexity of your model, I am pretty sure that you will experience other estimation problems. So, I suggest you to go through the examples in the forum and the manual, before going forward...
trubador
Did you use forum search?
 
Posts: 1024
Joined: Thu Nov 20, 2008 12:04 pm

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Fri Feb 17, 2012 2:31 pm

Ok, it runs flawless. I haven't check the accuracy of the estimation. But, if i want to declare initial states for the variables, how do i make it? can you give me a link? By the way, thanks for your help. Not even in weeks i'd would have made it. Thanks again.
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby trubador on Mon Feb 20, 2012 12:35 am

EViews' help files, users guide and Startz's "EViews Illustrated" would be good places to begin with. Other than that, you can search this forum for discussions and solutions on similar issues...
trubador
Did you use forum search?
 
Posts: 1024
Joined: Thu Nov 20, 2008 12:04 pm

Re: Kalman filter and NAIRU, declaring space/state

Postby jfca283 on Thu Feb 23, 2012 1:16 am

i've been searching and i found a code @mprior or @vprior, but neither the manual nor on the forum detail how to use those functions.
jfca283
 
Posts: 21
Joined: Mon Jan 09, 2012 8:58 am

Re: Kalman filter and NAIRU, declaring space/state

Postby EViews Glenn on Thu Feb 23, 2012 11:08 am

EViews 7 User's Guide II
Chapter 33. State Space Models and the Kalman Filter
Specifying Initial Conditions, p. 497-498.
EViews Glenn
EViews Developer
 
Posts: 1980
Joined: Wed Oct 15, 2008 9:17 am


Return to Estimation

Who is online

Users browsing this forum: Bing [Bot] and 4 guests