The following should work:
wrapper_function.m (1.3 KB)
Loop_main.m (1.2 KB)
allcomb.m (4.2 KB)
Loop_dynare.mod (6.5 KB)
get_consumption_equivalent_conditional_welfare.m (2.3 KB)
Yes! Thank you very much!
Hi Johannes,
I recognized that the csolve for finding the consumption equivalent is not converging unless I use āinitvalā instead of āsteady_state_modelā. This is for my model as well as for your example code posted above. I added a simpler version of it, where I took out the wrapper function and just gave parameter values.
Any idea why this could be the case?
without_wrapper.zip (6.2 KB)
Thanks!
You need to fix your steady state file. If you set
lambda_utility=0.01;
you will get an error message.
Sorry, I donāt understand this. In the mod files lambda_utility is set to 0.
What Iām saying is that if I run
dynare Loop_dynare_new.mod %in this .mod file the steady state is specificied using steady_state_model;
lambda_conditional=csolve(āget_consumption_equivalent_conditional_welfareā,0,,1e-8,1000,M_, options_, oo_);
ā The csolve stops after 1000 iterations with still a large outvalue.
If I run the following instead
dynare Loop_dynare_new_v1.mod %in this .mod file the steady state is specificied using initval;
lambda_conditional=csolve(āget_consumption_equivalent_conditional_welfareā,0,,1e-8,1000,M_, options_, oo_);
ā The csolve converges quickly.
The mod file needs to work for every value of lambda_utility between 0 and 1. Your steady_state_model-block only works for lambda_utility=0.
Ok, so I guess using initval; gives the steady state block this flexibility? So, is it okay to use initval; instead? How else could I allow for every value of lambda_utility between 0 and 1?
The .mod file with the steady_state_model-block with lambda_utility=0 is exactly the one you uploaded in November 2024.
Since I have a very large model, I changed the procedure a bit: I run the parfor loop first, just storing Recursive_Welfare. Then, in a second step, I do the csolve for the consumption equivalent only for the parameter combination with the highest Recursive_Welfare. This speeds up things considerably with my code.
Yes, usually using initval should be fine, but slower.
Regarding fixing the steady state file, you set
Recursive_natural_welfare_equivalent = Welf_SS;
but that is only true for lambda_utility.
Thank you for your reply! Okay, so, I will just run my files with initval. It takes a while, but they converge at some point.
Please note that the
Recursive_natural_welfare_equivalent = Welf_SS;
is also from the files you uploaded in November. It does not converge on my computer. I am wondering whether I overlooked anything.
That is clearly a mistake. A correct file would be
Loop_dynare_new.mod (6.5 KB)
Thank you for clarification!