diff --git a/matlab/+pac/+estimate/iterative_ols.m b/matlab/+pac/+estimate/iterative_ols.m index d4bce328b..b233277b8 100644 --- a/matlab/+pac/+estimate/iterative_ols.m +++ b/matlab/+pac/+estimate/iterative_ols.m @@ -418,19 +418,24 @@ function [PacExpectations, Model] = UpdatePacExpectationsData(dataPAC0, dataPAC1 % Add correction for growth neutrality if required. correction = 0; 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' - 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' - 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; correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index); 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; correction = GrowthVariable*Model.params(Model.pac.(pacmodl).growth_neutrality_param_index); otherwise error('Not yet implemented.') end end - PacExpectations = PacExpectations+correction; \ No newline at end of file + PacExpectations = PacExpectations+correction; diff --git a/matlab/print_expectations.m b/matlab/print_expectations.m index 3fec43fb7..8d310eefa 100644 --- a/matlab/print_expectations.m +++ b/matlab/print_expectations.m @@ -307,23 +307,28 @@ for i=1:maxlag end if isequal(id, 1) 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); vgrowth = expectationmodel.growth_str; - switch expectationmodel.growth_type + switch expectationmodel.growth_type{1} case 'parameter' vgrowth = M_.params(strcmp(vgrowth, M_.param_names)); otherwise vgrowth = regexprep(vgrowth, '\<(?!diff\>)\<(?!log\>)\<(?!\d\>)\w+', 'dbase.$0'); end if parameter>=0 - switch expectationmodel.growth_type + switch expectationmodel.growth_type{1} case 'parameter' expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(parameter, '%1.16f'), variable); otherwise expression = sprintf('%s*%s+%s*%s', num2str(pgrowth, '%1.16f'), vgrowth, num2str(parameter, '%1.16f'), variable); end else - switch expectationmodel.growth_type + switch expectationmodel.growth_type{1} case 'parameter' expression = sprintf('%s*%s-%s*%s', num2str(pgrowth, '%1.16f'), num2str(vgrowth, '%1.16f'), num2str(-parameter, '%1.16f'), variable); otherwise @@ -348,4 +353,4 @@ fclose(fid); fprintf('Expectation dseries expression is saved in %s.\n', filename); -skipline(); \ No newline at end of file +skipline();