Hi, I wonder whether Dnyare can do the estimation of exogenous shocks (declared in exovar in mod file) in a deterministic model? Is it possible to use MLE for a deterministic model? If so, is there any example code available? Thanks in advance!
For instance, I first declare the shock values in the parameter block and call them in the shock block.
exovar z ; // productivity
parameters; z1 z2 z3;
values z1 z2 z3;
In order to be able to write down a (non-degenerate) likelihood function, the model must feature stochastics. That is not the case in a deterministic model (at least not in the usual sense). You cannot find the “most likely shock”. What sometimes can be done is to invert the model. If there is a one-to-one mapping between observables and shocks, you can infer the exact shock sequence giving rise to the observables (as there is only one such sequence)
Thanks for your reply! I see what you mean. May I bother you with one more question?
Is it possible for ‘lmmcp’ to compute the deterministic model with downward nominal wage rigidity? Coz I want to generate unemployment in my model. In particular, I set:
W_t >= W_t-1 x (1-delta), (each time revise the wage down by delta only)
l_t <= l_bar (l_bar is total labor supply)
I wonder whether including a slackness condition ( W_t - W_t-1 x (1-delta)) x ( l_t - l_bar ) = 0 can help with the computation here.
I get this idea from your code for SIR model, where you mentioned a slackness condition is imposed to present infection number to be negative.
If not working, how about re-setting W_t >= W_bar x (1-delta) (W_bar is constant)?
Thanks very much in advance!
Here is a DNWR example from my own work: BDMP_DNWR.mod (2.7 KB)
The sample code is most helpful. Thanks so much!
Regarding your previous suggestion, i.e. infer exact shock from observables in a deterministic model, what comes to my mind is using ‘fminsearch’ with each iteration calling dynare to compute the path. Is there any dynare built-in tool to do so?
I noticed ‘modeqs.mod’ can do variable flipping for steady state and wonder whether any similar function can be applied to transition path?
Thanks so much again!
Sorry for the late reply. Your suggestion is more efficient and largely improve my computation.
May I ask one more question about your SIR code? I noticed your model/code abstracts from modelling the dead population. I guess it is due to its impact on the new steady state. In that case, different path leads to different steady state. The steady state and transition path have to be pinned down simultaneously. I wonder whether dynare can solve a model like that?
Thanks a lot always!
My hunch is that this should be doable, e.g. via the
differentiate_forward_vars option of the
model block. See e.g. https://git.dynare.org/Dynare/dynare/-/blob/master/tests/differentiate_forward_vars/RBC_differentiate_forward.mod
Hi Prof: Thanks for your kind suggestion! I shall have a try on this function.
Meanwhile, I wonder what is the difference between
extended_path? I know the latter is also dealing with permanent shock and changable steady state.
Thanks so much！
extended_path are two different things, even if the first one can help the second one (attached is a note I wrote when we developed the
differentiate_forward_vars option, the source code with an example is available at https://git.adjemian.eu/stepan/differentiated-forward-variables). Currently the extended path approach only deals with unexpected temporary shocks (not affecting the steady state, ie the terminal condition).
note.pdf (166.5 KB)
Thanks so much for your detailed explanations on both tools. I have tried
differentiate_forward_vars on my own code and it runs well. But I have several questions when comparing your sample code with mine:
1) Does it matter what values to give in
My code is a standard SIR model, so I am unable to mannually compute the steady state as is done in the sample code. Instead, I cheated the
steady check by giving some values that are guessed to be close to the new steady state. Is it a correct way to do the set-up? Ep_simul2.mod (2.0 KB)
2) No longer require a junk variable?
There are only backward-looking variables in my code. Have dynare 4.5.6 solved this problem?
3) Sample code or notes on
Is there any explanatory notes/codes on this tool about when and how to use it?
Thanks so much for your kind help!
In my slides about perfect foresight models:
I have some explanations and examples. Other documents are available elsewhere (just google for extended path), and you have examples in the
tests/ep folder. But I don’t think you really need extended path to simulate you model (if the model is backward).
Thanks for the explanations. I just skip
check and dynare no longer requires the steady state values.
In the early post of this strand, I asked about how to use both
differentiate_foward_vars. They work quite well seperately. However when they are combined, it seems very difficult for
lmmcp to find the soluation. It becomes even unstable when there are two binding constraints, i.e. DNWR for two countries.
I have tried two ways: using unbinding or loose binding solutions as the initial values (as you suggested in another post), and extending the periods. Sometimes it works, but it’s quite easy to fail. Do you have similar experience? Or are there any tricks or anything I need to pay attention to when using
Thanks a lot!
Hi Stéphane: Thanks so much for sharing the slides. They are most helpful!
Do you have examples of
differentiate_foward_vars actually working together as expected?
Yes, in a macro model equipped by SIR mechanism. I use
lmmcp to do DNWR and generate unemployment. It works when the binding constraint is very loose. As a test, I allow the nominal wage to drop by over 20% (weekly frequency). Only several periods see binding. And the unemployment rate is only around 1e-5.
Then I used it as the initial values and futher tightened the minimum wage change to 18%. Then it stuck at the first round of iteration, not yet entering homotopy stage. BTW, when the condition is too loose to bind (never bind), the code runs absolutely well.
Is it because of the model size, or did I give too short period (I set 1000 in my case)? I have to appologize due to the confidential reasons I am not able to share the code with you. I guess maybe it will be helpful to know what types/features of models that
lmmcp is suitable for or any experience related to that.
Thanks so much.
That’s hard to tell. I was asking because I am not sure Dynare correctly transforms the problem in this case.