Temporary fix for growth parameter in PAC models
The preprocessor has been modified to allow linear combinations in the growth parameter (see Dynare/preprocessor@a0f74f5c16 and Dynare/preprocessor@d873414728). This commit restores the previous functionality (i.e. it fixes the simple case where only one parameter/variable is provided for the growth parameter). The code still needs to be adapted to really handle linear combinations.time-shift
parent
e2c57dc5f5
commit
8e1528c1cb
|
@ -418,15 +418,20 @@ function [PacExpectations, Model] = UpdatePacExpectationsData(dataPAC0, dataPAC1
|
||||||
% Add correction for growth neutrality if required.
|
% Add correction for growth neutrality if required.
|
||||||
correction = 0;
|
correction = 0;
|
||||||
if isfield(Model.pac.(pacmodl), 'growth_type')
|
if isfield(Model.pac.(pacmodl), 'growth_type')
|
||||||
switch Model.pac.(pacmodl).growth_type
|
if numel(Model.pac.(pacmodl).growth_type) > 1 || ...
|
||||||
|
Model.pac.(pacmodl).growth_constant(1) ~= 1 || ...
|
||||||
|
Model.pac.(pacmodl).growth_param_id(1) ~= 0
|
||||||
|
error('Linear combinations in growth parameter are not yet supported')
|
||||||
|
end
|
||||||
|
switch Model.pac.(pacmodl).growth_type{1}
|
||||||
case 'parameter'
|
case 'parameter'
|
||||||
correction = Model.params(Model.pac.(pacmodl).growth_index)*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
correction = Model.params(Model.pac.(pacmodl).growth_index(1))*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
||||||
case 'exogenous'
|
case 'exogenous'
|
||||||
GrowthVariable = data{Model.exo_names{Model.pac.(pacmodl).growth_index}};
|
GrowthVariable = data{Model.exo_names{Model.pac.(pacmodl).growth_index(1)}};
|
||||||
GrowthVariable = GrowthVariable(range).data;
|
GrowthVariable = GrowthVariable(range).data;
|
||||||
correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
||||||
case 'endogenous'
|
case 'endogenous'
|
||||||
GrowthVariable = data{Model.endo_names{Model.pac.(pacmodl).growth_index}}.lag(abs(Model.pac.(pacmodl).growth_lag));
|
GrowthVariable = data{Model.endo_names{Model.pac.(pacmodl).growth_index(1)}}.lag(abs(Model.pac.(pacmodl).growth_lag(1)));
|
||||||
GrowthVariable = GrowthVariable(range).data;
|
GrowthVariable = GrowthVariable(range).data;
|
||||||
correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index);
|
||||||
otherwise
|
otherwise
|
||||||
|
|
|
@ -307,23 +307,28 @@ for i=1:maxlag
|
||||||
end
|
end
|
||||||
if isequal(id, 1)
|
if isequal(id, 1)
|
||||||
if isequal(expectationmodelkind, 'pac') && growth_correction
|
if isequal(expectationmodelkind, 'pac') && growth_correction
|
||||||
|
if numel(expectationmodel.growth_type) > 1 || ...
|
||||||
|
expectationmodel.growth_constant(1) ~= 1 || ...
|
||||||
|
expectationmodel.growth_param_id(1) ~= 0
|
||||||
|
error('Linear combinations in growth parameter are not yet supported')
|
||||||
|
end
|
||||||
pgrowth = M_.params(expectationmodel.growth_neutrality_param_index);
|
pgrowth = M_.params(expectationmodel.growth_neutrality_param_index);
|
||||||
vgrowth = expectationmodel.growth_str;
|
vgrowth = expectationmodel.growth_str;
|
||||||
switch expectationmodel.growth_type
|
switch expectationmodel.growth_type{1}
|
||||||
case 'parameter'
|
case 'parameter'
|
||||||
vgrowth = M_.params(strcmp(vgrowth, M_.param_names));
|
vgrowth = M_.params(strcmp(vgrowth, M_.param_names));
|
||||||
otherwise
|
otherwise
|
||||||
vgrowth = regexprep(vgrowth, '\<(?!diff\>)\<(?!log\>)\<(?!\d\>)\w+', 'dbase.$0');
|
vgrowth = regexprep(vgrowth, '\<(?!diff\>)\<(?!log\>)\<(?!\d\>)\w+', 'dbase.$0');
|
||||||
end
|
end
|
||||||
if parameter>=0
|
if parameter>=0
|
||||||
switch expectationmodel.growth_type
|
switch expectationmodel.growth_type{1}
|
||||||
case 'parameter'
|
case 'parameter'
|
||||||
expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(parameter, '%1.16f'), variable);
|
expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(parameter, '%1.16f'), variable);
|
||||||
otherwise
|
otherwise
|
||||||
expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), vgrowth, num2str(parameter, '%1.16f'), variable);
|
expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), vgrowth, num2str(parameter, '%1.16f'), variable);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
switch expectationmodel.growth_type
|
switch expectationmodel.growth_type{1}
|
||||||
case 'parameter'
|
case 'parameter'
|
||||||
expression = sprintf('%s*%s-%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(-parameter, '%1.16f'), variable);
|
expression = sprintf('%s*%s-%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(-parameter, '%1.16f'), variable);
|
||||||
otherwise
|
otherwise
|
||||||
|
|
Loading…
Reference in New Issue