Do not include the original names of the transformed endogenous variables.

time-shift
Stéphane Adjemian (Odysseus) 2020-01-30 20:31:21 +01:00
parent 3dbc7640d9
commit 5289636f69
1 changed files with 2 additions and 10 deletions

View File

@ -70,9 +70,6 @@ plist = {};
elist = {}; elist = {};
xlist = {}; xlist = {};
eappend = {};
xappend = {};
for i=1:length(eqtags) for i=1:length(eqtags)
rhs = []; rhs = [];
lhs = []; lhs = [];
@ -98,12 +95,10 @@ for i=1:length(eqtags)
rep = strcmp(tmp{1}, enames); rep = strcmp(tmp{1}, enames);
if any(rep) if any(rep)
enames(rep) = tmp(2); enames(rep) = tmp(2);
eappend = union(eappend, tmp{2});
end end
rep = strcmp(tmp{1}, xnames); rep = strcmp(tmp{1}, xnames);
if any(rep) if any(rep)
xnames(rep) = tmp(2); xnames(rep) = tmp(2);
xappend = union(xappend, tmp{2});
end end
end end
end end
@ -151,14 +146,11 @@ for i=1:length(eqtags)
pnames = union(pnames, expectation_pnames); pnames = union(pnames, expectation_pnames);
xnames = union(xnames, setdiff(expectation_xnames, expectation_pnames)); xnames = union(xnames, setdiff(expectation_xnames, expectation_pnames));
enames = union(enames, expectation_enames); enames = union(enames, expectation_enames);
enames = union(enames, LHS);
fprintf(fid, '[name=''%s'']\n', lhs); fprintf(fid, '[name=''%s'']\n', lhs);
fprintf(fid, '%s = %s;\n\n', lhs, rhs); fprintf(fid, '%s = %s;\n\n', lhs, rhs);
else else
eLHS = get_variables_and_parameters_in_expression(LHS);
pRHS = get_variables_and_parameters_in_equation('', RHS, M_); pRHS = get_variables_and_parameters_in_equation('', RHS, M_);
xRHS = get_variables_and_parameters_in_expression(RHS); xRHS = get_variables_and_parameters_in_expression(RHS);
enames = union(enames, eLHS);
xnames = union(xnames, setdiff(xRHS, pRHS)); xnames = union(xnames, setdiff(xRHS, pRHS));
pnames = union(pnames, pRHS); pnames = union(pnames, pRHS);
end end
@ -214,13 +206,13 @@ end
% Export endogegnous variables % Export endogegnous variables
fid = fopen(sprintf('%s/endogenous.inc', outfold), 'w'); fid = fopen(sprintf('%s/endogenous.inc', outfold), 'w');
printlistofvariables(fid, 'endo', elist, M_, eappend); printlistofvariables(fid, 'endo', elist, M_, elist);
fclose(fid); fclose(fid);
% Export exogenous variables % Export exogenous variables
if ~isempty(xlist) if ~isempty(xlist)
fid = fopen(sprintf('%s/exogenous.inc', outfold), 'w'); fid = fopen(sprintf('%s/exogenous.inc', outfold), 'w');
printlistofvariables(fid, 'exo', xlist, M_, xappend); printlistofvariables(fid, 'exo', xlist, M_, xlist);
fclose(fid); fclose(fid);
end end