I am working on Iacoviello (2017), “Collateral Constraints and Macroeconomic Asymmetries,” and try to add a search and matching mechanism on to the impatient households (which also act as entrepreneurs/managers in Iacoviello’s model). The search and matching mechanism I adopted is a very simple one (pls see the attached), so I add 5 new endogenous variables and treat the wage of impatient households (variable w1) as a parameter. The first six equations in the model module in my Dynare core is what I added on. Due to the nonlinear equations, I could not compute the analytical steady state manually, so I turn to the initval value strategy. But the Dynare core ends up with ‘Impossible to find the steady state. Either the model doesn’t have a unique steady state of the guess values are too far from the solution’. I have tried different timing for predetermined variables and different starting values for steady states but still couldn’t solve it. I know the reason behind might be complicated. Most starting values stay the same with those in Iacoviello (2017), as I think I do not change too much. Does someone have an idea how to overcome this problem?matchingmodelp.pdf (86.6 KB) my work.mod (6.3 KB) Replication code from Iacoviello’s website.zip (6.1 KB)
Thank you so much for your response. I’ve fixed the timing problem, now the mod file can be run under Dynare 4.5.6 and 4.5.7 versions, but not under 4.3.1. As I want to apply the Iacoviello’s occbin toolkit, a new problem arisen is the toolkit for two constraints does not work under Dynare 4.5.6. I have tried Iacoviello’s original codes, they are also incompatible with Dynare 4.5.6, but the difference is his single mod file can be run under 4.3.1, so the whole occbin can be run under 4.3.1. Under 4.5.6, the error is ‘Reference to non-existent field ‘nstatic’. The error is located in one toolkit file ‘get_pq’, there is dr_.nstatic. Do you have an idea how to solve it?
In such cases, please provide the full error message and the code where it occurs. From what I can see, the problem comes from Dynare moving the model information like the number of static variables from the decision rule structure oo_.dr. to the model structure M_. So you need to replace this occurrence with M_.nstatic
Many thanks for your advice. I have tried the M_.nstatic, but it still does not work. I paste the error message and code in the attachment ‘error’. Another attachment is the full set code I tried, I first run the ‘setpathdynare4.m’ to set path (linked to 4.5.6 or 4.3.1), and then run the m file ‘runsim_plot_figure3 ’. Then the error occurs. replication_figure3_4 - w1 - initval2.zip (1.5 MB) error.zip (57.8 KB)
The four mod files, baby00, baby01, baby10, baby11, are for the setup of two constraints, relaxing or binding. The single mod file, baby00 can be run under 4.5.6.
Hope this message finds you well. I am using the modified Occbin toolkit under dynare 4.6.1, running a simple three equation NK model. And the code is downloaded from https://github.com/lucaguerrieri/occbin. and the code attached:
Error using eval
Must be a string scalar or character vector.
Error in solve_one_constraint (line 44)
eval([Mbase_.param_names(i_indx_,:),’= M_.params(i_indx_);’]);
Error in runsim_cgg (line 45)
solve_one_constraint(modnam,modnamstar,…
Error in run (line 91)
evalin(‘caller’, strcat(script, ‘;’));
I guess it’s still because of the occbin is not adaptable to new version dynare. May i know where i can get the new modified version occbin or how to modify it?
I’m using the toolkit above(and the latest one in Occbin_update)
However, when I run runsim_dnk in dynare 4.6.1, I got the error message related to the number of inputs (for steady state?). I guess this is similar to the problem of this one , but your modified toolbox code in github seems to be up-to-date, and I checked the path is set for modified toolbox rightly.
I’m using your modified Occbin toolkit and trying to replicate Guerrieri, Luca, and Matteo Iacoviello (2017), “Collateral Constraints and Macroeconomic Asymmetries,” Journal of Monetary Economics , vol. 90, October, pp.28-49.
However, It seems that solve_two_constraint in the modified toolkit is not working well.
I tried the modifications below.
・deleting “deblank” in solve_two_constraint so that eval can work well (following the way of solve_one_constraint)
・deleting external steady state file because the the way of external steady state file is changed but the source code in Guerrieri is not changed.
However, when I run the runsim_estimation.m , I got the error message below.
Reference to non-existent field ‘ghx’.
Error in get_pq (line 3)
nvars = size(dr_.ghx,1);
Error in solve_two_constraints (line 141)
[decrulea,decruleb]=get_pq(oo00_.dr,M00_);
Error in runsim_plot_figure3 (line 79)
[zdatal zdatap zdatass oobase_ Mbase_] = solve_two_constraints(…
How can I fix this error code? I know what dr_ghx is, but I couldn’t understand why the field is empty.
Unfortunately, the replication files are of very poor quality.
I spend a lot of time with the code and there are multiple reasons why it can crash.
There is also an issue with changes made in Dynare itself.
Due to changes in the preprocessor you have to tag the equation lm=0 within the regimes 10 and 11.
Otherwise, the function get_deriv will not behave as expected.
According to @jpfeifer tagging this static equation is the only workaround.
A will attach a replication for figure 3 in Guerrieri and Iacoviello (2017) that runs on the updated toolkit and dynare 4.6.3.
Thank you very much!! Your comment was very helpful and I managed to replicate Figures on matlab 4.6.3!
If you have modified other files (estimation, filtering, replication_figure_2_basic, replication_figure_4), I’m sorry if this sounds rude but could you show me your code?
I tried to run other files by modifying toolkits and runsimfile, but it doesn’t seem to work completely well. (I managed to replication_figure_2 to some degree, but other file didn’t work.)
The deblank issue in my repository was fixed two days ago
Deleting steady state file is not a good idea as the files may now fail to solve for the steady state. In that case, the decision rule structure will be empty, resulting in crashes like the one you mentioned. As @Max1 indicated, the replication files do not contain a proper error handling to deal with such issues. I have pushed a proper version of those file with a steady_state_model--block to my repository.
The tagging issue is indeed a problem in Dynare 4.6.3. When running plain Occbin from my repository, you will get an error message in my codes when calling solve_two_constraints.m. The problem is that the estimation routines never call that file, but rather a different one.
Using the Macro processing language is a very nice way to handle the mod-files when using the OccBin toolkit! No longer copy and paste everything from one mod-file to the other. Therefore, reducing the point of failure. Nice!