Write the growth correction term in a separate file.

time-shift
Stéphane Adjemian (Charybdis) 2019-02-27 22:26:07 +01:00
parent f07b1e8028
commit 8e60ded1bd
Signed by untrusted user who does not match committer: stepan
GPG Key ID: A6D44CB9C64CE77B
1 changed files with 24 additions and 15 deletions

View File

@ -241,21 +241,7 @@ for i=1:maxlag
end
end
if isequal(id, 1)
if isequal(expectationmodelkind, 'pac-expectations') && growth_correction
pgrowth = M_.param_names{expectationmodel.growth_neutrality_param_index};
switch expectationmodel.growth_type
case 'parameter'
vgrowth = M_.param_names{expectationmodel.growth_index};
case 'endogenous'
vgrowth = M_.endo_names{expectationmodel.growth_index};
case 'exogenous'
vgrowth = M_.exo_names{expectationmodel.growth_index};
otherwise
end
expression = sprintf('%s*%s+%s*%s', pgrowth, vgrowth, parameter, variable);
else
expression = sprintf('%s*%s', parameter, variable);
end
expression = sprintf('%s*%s', parameter, variable);
else
expression = sprintf('%s + %s*%s', expression, parameter, variable);
end
@ -267,6 +253,29 @@ fclose(fid);
fprintf('Expectation unrolled expression is saved in %s.\n', filename);
%
% Second bis print the PAC growth neutrality correction term (if any).
%
if isequal(expectationmodelkind, 'pac-expectations') && growth_correction
filename = sprintf('%s/model/%s/%s-%s-growth-neutrality-correction.inc', M_.fname, expectationmodelkind, eqtag, expectationmodelname);
fid = fopen(filename, 'w');
fprintf(fid, '// This file has been generated by dynare (%s).\n', datestr(now));
pgrowth = M_.param_names{expectationmodel.growth_neutrality_param_index};
switch expectationmodel.growth_type
case 'parameter'
vgrowth = M_.param_names{expectationmodel.growth_index};
case 'endogenous'
vgrowth = M_.endo_names{expectationmodel.growth_index};
case 'exogenous'
vgrowth = M_.exo_names{expectationmodel.growth_index};
otherwise
end
fprintf(fid, '%s*%s', pgrowth, vgrowth);
fclose(fid);
fprintf('Growth neutrality correction is saved in %s.\n', filename);
end
%
% Third print a routine for evaluating VAR_EXPECTATION/PAC_EXPECTATION term (returns a dseries object).
%