Estmation in deterministic model

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.

varobs c;

exovar z ; // productivity
parameters; z1 z2 z3;

shocks;
var z
period 1:3;
values z1 z2 z3;
end;

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)

Dear Prof.:

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.

https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Stock_SIR_2020/Stock_SIR_2020.mod

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)

1 Like

Hi Prof.:

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!

  1. No, there is no tool to do this in perfect foresight.
  2. You actually don’t need to loop over Dynare, just over the underlying routines. I.e. you miminize over setting oo_.exo_simul and then running perfect_foresight_solver.

Hi Professor:

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 differentiate_forward_vars and extended_path? I know the latter is also dealing with permanent shock and changable steady state.

Thanks so much!

Hi, differentiate_forward_vars and 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).

Best,
Stéphane.

note.pdf (166.5 KB)

Hi Stephane:

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 endval block?
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 extended_path
Is there any explanatory notes/codes on this tool about when and how to use it?

Thanks so much for your kind help!

  1. You are calling steady after endval, so Dynare will compute a steady state given the values of the exogenous variables provided. That being said, if the model is purely backward-looking, the terminal values do not matter in any case.
  2. The problem with backward-looking models only occurs for stochastic simulations or the lmmcp-solver. You are not using any of those.
  3. @stepan-a should answer this.

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).

Hi Prof.:

Thanks for the explanations. I just skip steady and check and dynare no longer requires the steady state values.

In the early post of this strand, I asked about how to use both lmmcp and 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 lmmcp?

Thanks a lot!

Hi Stéphane: Thanks so much for sharing the slides. They are most helpful!

Do you have examples of lmmcp and 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.