Extended Kalman Filter
Extended Kalman Filter
Hi all,
I'm trying to code a dsge model with a threshold interest rate rule, so I need to perform the extended Kalman Filter. An example is the attached paper. Is there a similar example available?
Thanks in advance
I'm trying to code a dsge model with a threshold interest rate rule, so I need to perform the extended Kalman Filter. An example is the attached paper. Is there a similar example available?
Thanks in advance
- Attachments
-
- Barthelemy_Clerc_Marx.pdf
- (369.14 KiB) Downloaded 872 times
Re: Extended Kalman Filter
For each function evaluation, you have to solve the model for each of the two states. To do that, you'll need alternative FRML's where a particular equation depends upon state-dependent parameters (I believe that's just the interest rate equation), and you'll need two GROUP instructions which put together the two collections of equations. Those are set up in advance. Then, for a function evaluation, you do DSGE instructions on the two models to get two state-space representations.
Since kappa-c and N-c are fixed for a given experiment, you can compute the state switching dummy in advance. That's most conveniently handled by defining a SERIES[INTEGER] which is 1 or 2:
This will be called to solve the two models at every function evaluation:
and this (with other options), will compute the log likelihood:
Since kappa-c and N-c are fixed for a given experiment, you can compute the state switching dummy in advance. That's most conveniently handled by defining a SERIES[INTEGER] which is 1 or 2:
Code: Select all
dec series[int] state
gset state = fix(??? which evaluates to 1 or 2)This will be called to solve the two models at every function evaluation:
Code: Select all
dec vect[rect] a(2) f(2)
function SolveModels
dsge(model=dsge1,a=a(1),f=f(1)) list of variables
dsge(model=dsge2,a=a(2),f=f(2)) list of variables
end SolveModel
Code: Select all
dlm(startup=SolveModels(),a=a(state(t)),f=f(state(t)),...Re: Extended Kalman Filter
Thanks a lot Tom
So I guess the procedure gets more complicated once kappa-c becomes time varying (as is the case in my work).
Another thing that causes me troubles is that after the fix function I get the following message
## SR13. Need to Include an Entry Range. No Previous Instruction Has Set the Default
I haven't used the fix function before so I must be doing sth wrong.
Thanks in advance
So I guess the procedure gets more complicated once kappa-c becomes time varying (as is the case in my work).
Another thing that causes me troubles is that after the fix function I get the following message
## SR13. Need to Include an Entry Range. No Previous Instruction Has Set the Default
I haven't used the fix function before so I must be doing sth wrong.
Thanks in advance
Re: Extended Kalman Filter
You can't set that up that series until you have data; that's the complaint--that it doesn't know what the range is. You can either do an ALLOCATE to set the range to match your data, or just read the data up near the top.
How is kappa-c supposed to vary in your model? As long as the state can be computed in advance, the general strategy above should work.
How is kappa-c supposed to vary in your model? As long as the state can be computed in advance, the general strategy above should work.
Re: Extended Kalman Filter
So in my case, assuming that kappa is not time varying, I want to define the ''dummy'' to be equal to 1 whenver inflation is equal to 2%.
After that, what I want to try is whether I can collapse the two models into one in order to generate the calibrated impulse responses.
So as you said I should use the allocate instruction instead of fix, no?
And if I understand well, the instruction for the impulse responses should like like the following:
@dlmirf(a=a(t), f=f(t)....)
or do I have to do sth else in order to generate the calibrated impulse responses?
After that, what I want to try is whether I can collapse the two models into one in order to generate the calibrated impulse responses.
So as you said I should use the allocate instruction instead of fix, no?
And if I understand well, the instruction for the impulse responses should like like the following:
@dlmirf(a=a(t), f=f(t)....)
or do I have to do sth else in order to generate the calibrated impulse responses?
Re: Extended Kalman Filter
Another example is the paper by Davig and Leeper (2006), attached
- Attachments
-
- Davig and Leeper.pdf
- (369.96 KiB) Downloaded 896 times