add_auxiliary_variables_to_steadystate.m
Posted: Mon Oct 17, 2011 9:53 pm
Greetings,
I have a model in which Dynare opts to use auxiliary variables. I have and _steadystate.m file that worked fine with 4.2.1. It still works with 4.2.2, eventually, but I get hundreds of warnings that look like this:
Warning: Divide by zero.
> In cmr_static at 147
In add_auxiliary_variables_to_steadystate at 30
In steady_ at 56
In steady at 54
In cmr at 2472
In dynare at 120
I run Mac OSX, Matlab R2009a. The only difference in any of the files from 4.2.1 to 4.2.2 is in add_auxiliary_variables_to_steadystate.m. Several lines were deleted. Those deletions cause my problem. When I run the code with the add_auxiliary_variables_to_steadystate.m file from 4.2.1 and the rest of 4.2.2, everything again works without complaint.
I included in this post a diff for the relevant files to verify the differences. Is there a way that I can avoid these warnings? Was there a reason to delete the lines of code in the m file?
Best,
Ben
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/steady.m /Applications/Dynare/4.2.2/matlab/steady.m
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/steady_.m /Applications/Dynare/4.2.2/matlab/steady_.m
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/add_auxiliary_variables_to_steadystate.m /Applications/Dynare/4.2.2/matlab/add_auxiliary_variables_to_steadystate.m
23,32d22
< k = size(ys,1)+1;
< aux_lead_nbr = 0;
< for i=1:n
< if aux_vars(i).type == 1
< ys1(k) = ys(aux_vars(i).orig_index);
< elseif aux_vars(i).type == 0
< aux_lead_nbr = aux_lead_nbr + 1;
< end
< k = k+1;
< end
34c24
< for i=1:aux_lead_nbr+1;
---
> for i=1:n+1;
45,48c35,36
< if aux_vars(j).type == 0
< el = aux_vars(j).endo_index;
< ys1(el) = ys1(el)-res(el);
< end
---
> el = aux_vars(j).endo_index;
> ys1(el) = ys1(el)-res(el);
I have a model in which Dynare opts to use auxiliary variables. I have and _steadystate.m file that worked fine with 4.2.1. It still works with 4.2.2, eventually, but I get hundreds of warnings that look like this:
Warning: Divide by zero.
> In cmr_static at 147
In add_auxiliary_variables_to_steadystate at 30
In steady_ at 56
In steady at 54
In cmr at 2472
In dynare at 120
I run Mac OSX, Matlab R2009a. The only difference in any of the files from 4.2.1 to 4.2.2 is in add_auxiliary_variables_to_steadystate.m. Several lines were deleted. Those deletions cause my problem. When I run the code with the add_auxiliary_variables_to_steadystate.m file from 4.2.1 and the rest of 4.2.2, everything again works without complaint.
I included in this post a diff for the relevant files to verify the differences. Is there a way that I can avoid these warnings? Was there a reason to delete the lines of code in the m file?
Best,
Ben
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/steady.m /Applications/Dynare/4.2.2/matlab/steady.m
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/steady_.m /Applications/Dynare/4.2.2/matlab/steady_.m
bash-3.2$ diff /Applications/Dynare/4.2.1/matlab/add_auxiliary_variables_to_steadystate.m /Applications/Dynare/4.2.2/matlab/add_auxiliary_variables_to_steadystate.m
23,32d22
< k = size(ys,1)+1;
< aux_lead_nbr = 0;
< for i=1:n
< if aux_vars(i).type == 1
< ys1(k) = ys(aux_vars(i).orig_index);
< elseif aux_vars(i).type == 0
< aux_lead_nbr = aux_lead_nbr + 1;
< end
< k = k+1;
< end
34c24
< for i=1:aux_lead_nbr+1;
---
> for i=1:n+1;
45,48c35,36
< if aux_vars(j).type == 0
< el = aux_vars(j).endo_index;
< ys1(el) = ys1(el)-res(el);
< end
---
> el = aux_vars(j).endo_index;
> ys1(el) = ys1(el)-res(el);