Fix growth neutrality correction in PAC equations.

- Force long run levels of the exogenous variables to be zero or g (the BGP growth rate of the LHS endogenous variable).
- Fix the correction of the correction for the share λ (aak γ).
- Provisions for the case where the long run level of the exogenous variable is
different from 0 or g (see tmp1 and ll which should be added to the growth
neutrality correction as a constant).

(cherry picked from commit a4423d734e1df1d4ee09c7225d7fd610e0d94cd1)
pac-components
Stéphane Adjemian (Ryûk) 2021-10-14 11:46:09 +02:00
parent 96c24b3052
commit f778e3c1ce
Signed by: stepan
GPG Key ID: 295C1FE89E17EB3C
6 changed files with 195 additions and 47 deletions

View File

@ -76,11 +76,72 @@ for e=1:number_of_pac_eq
[G, alpha, beta] = buildGmatrixWithAlphaAndBeta(params);
M_.params(pac_equation.mce.alpha) = alpha;
if isfield(pacmodel, 'growth_neutrality_param_index')
if isfield(equations.(eqtag), 'non_optimizing_behaviour')
gamma = M_.params(equations.(eqtag).share_of_optimizing_agents_index);
else
gamma = 1.0;
end
A = [alpha; 1];
A_1 = polyval(A, 1.0);
A_b = polyval(A, beta);
m = length(alpha);
d = A_1*A_b*(iota(m, m)'*inv((eye(m)-G)*(eye(m)-G))*iota(m, m));
M_.params(pacmodel.growth_neutrality_param_index) = 1-sum(params(2:end-1))-d;
cc = 1/gamma-(sum(params(2:end-1))+d);
ll = 0;
if isfield(equations.(eqtag), 'optim_additive')
% Exogenous variables are present in the λ part (optimizing agents).
tmp0 = 0;
for i=1:length(equations.(eqtag).optim_additive.params)
if isnan(equations.(eqtag).optim_additive.params(i)) && islogical(equations.(eqtag).optim_additive.bgp{i}) && equations.(eqtag).optim_additive.bgp{i}
tmp0 = tmp0 + equations.(eqtag).optim_additive.scaling_factor(i);
elseif ~isnan(equations.(eqtag).optim_additive.params(i)) && islogical(equations.(eqtag).optim_additive.bgp{i}) && equations.(eqtag).optim_additive.bgp{i}
tmp0 = tmp0 + M_.params(equations.(eqtag).optim_additive.params(i))*equations.(eqtag).optim_additive.scaling_factor(i);
elseif ~islogical(equations.(eqtag).optim_additive.bgp{i})
error('It is not possible to provide a value for the mean of an exogenous variable appearing in the optimal part of the PAC equation.')
end
end
cc = cc - tmp0;
end
if gamma<1
equations.(eqtag).('non_optimizing_behaviour')
if isfield(equations.(eqtag), 'non_optimizing_behaviour') && isfield(equations.(eqtag).non_optimizing_behaviour, 'params')
% Exogenous variables are present in the 1-λ part (rule of thumb agents).
tmp0 = 0;
tmp1 = 0;
for i=1:length(equations.(eqtag).non_optimizing_behaviour.params)
if isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && equations.(eqtag).non_optimizing_behaviour.bgp{i}
tmp0 = tmp0 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i);
elseif ~isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && equations.(eqtag).non_optimizing_behaviour.bgp{i}
tmp0 = tmp0 + M_.params(equations.(eqtag).non_optimizing_behaviour.params(i))*equations.(eqtag).non_optimizing_behaviour.scaling_factor(i);
elseif ~islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnumeric(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnan(equations.(eqtag).non_optimizing_behaviour.params(i))
tmp1 = tmp1 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.bgp{i};
elseif ~islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnumeric(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && ~isnan(equations.(eqtag).non_optimizing_behaviour.params(i))
tmp1 = tmp1 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.params(i)*equations.(eqtag).non_optimizing_behaviour.bgp{i};
end
end
cc = cc - (1-gamma)*tmp0/gamma;
ll = -(1.0-gamma)*tmp1/gamma; % TODO: ll should be added as a constant in the PAC equation (under the λ part) when unrolling pac_expectation.
end
end
if isfield(equations.(eqtag), 'additive')
% Exogenous variables are present outside of the λ and (1-λ) parts (or we have exogenous variables in a "pure" PAC equation.
tmp0 = 0;
tmp1 = 0;
for i=1:length(equations.(eqtag).additive.params)
if isnan(equations.(eqtag).additive.params(i)) && islogical(equations.(eqtag).additive.bgp{i}) && equations.(eqtag).additive.bgp{i}
tmp0 = tmp0 + equations.(eqtag).additive.scaling_factor(i);
elseif ~isnan(equations.(eqtag).additive.params(i)) && islogical(equations.(eqtag).additive.bgp{i}) && equations.(eqtag).additive.bgp{i}
tmp0 = tmp0 + M_.params(equations.(eqtag).additive.params(i))*equations.(eqtag).additive.scaling_factor(i);
elseif ~islogical(equations.(eqtag).additive.bgp{i}) && isnumeric(equations.(eqtag).additive.bgp{i}) && isnan(equations.(eqtag).additive.params(i))
tmp1 = tmp1 + equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.bgp{i};
elseif ~islogical(equations.(eqtag).additive.bgp{i}) && isnumeric(equations.(eqtag).additive.bgp{i}) && ~isnan(equations.(eqtag).additive.params(i))
tmp1 = tmp1 + equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.params(i)*equations.(eqtag).additive.bgp{i};
end
end
cc
cc = cc - tmp0/gamma;
ll = ll - tmp1/gamma; % TODO: ll should be added as a constant in the PAC equation (under the λ part) when unrolling pac_expectation.
end
M_.params(pacmodel.growth_neutrality_param_index) = cc; % Multiplies the variable or expression provided though the growth option in command pac_model.
end
end

View File

@ -173,7 +173,7 @@ for e=1:number_of_pac_eq
if ~isempty(equations.(eqtag).h1_param_indices)
DynareModel.params(equations.(eqtag).h1_param_indices) = .0;
end
end
end
% Update the parameter related to the growth neutrality correction.
if isfield(equations.(eqtag), 'non_optimizing_behaviour')
gamma = DynareModel.params(equations.(eqtag).share_of_optimizing_agents_index);
@ -185,46 +185,61 @@ for e=1:number_of_pac_eq
% there is no exogenous variables in the model and in the
% absence of non optimizing agents.
gg = -(growthneutrality-1); % Finite sum of autoregressive parameters + infinite sum of the coefficients in the PAC expectation term.
cc = 1.0-gamma*gg; % First adjustment of the growth neutrality correction (should also be divided by gamma, done below at the end of this section).
% We may have to further change the correction if we have nonzero mean exogenous variables.
cc = 1.0/gamma-gg; % First adjustment of the growth neutrality correction (should also be divided by gamma, done below at the end of this section).
% We may have to further change the correction if we have nonzero mean exogenous variables.
ll = 0.0;
if isfield(equations.(eqtag), 'optim_additive')
% Exogenous variables are present in the λ part (optimizing agents).
tmp = 0;
tmp0 = 0;
for i=1:length(equations.(eqtag).optim_additive.params)
if isnan(equations.(eqtag).optim_additive.params(i)) && equations.(eqtag).optim_additive.bgp(i)
tmp = tmp + equations.(eqtag).optim_additive.scaling_factor(i)*equations.(eqtag).optim_additive.bgp(i);
elseif ~isnan(equations.(eqtag).optim_additive.params(i)) && equations.(eqtag).optim_additive.bgp(i)
tmp = tmp + DynareModel.params(equations.(eqtag).optim_additive.params(i))*equations.(eqtag).optim_additive.scaling_factor(i)*equations.(eqtag).optim_additive.bgp(i);
if isnan(equations.(eqtag).optim_additive.params(i)) && islogical(equations.(eqtag).optim_additive.bgp{i}) && equations.(eqtag).optim_additive.bgp{i}
tmp0 = tmp0 + equations.(eqtag).optim_additive.scaling_factor(i);
elseif ~isnan(equations.(eqtag).optim_additive.params(i)) && islogical(equations.(eqtag).optim_additive.bgp{i}) && equations.(eqtag).optim_additive.bgp{i}
tmp0 = tmp0 + DynareModel.params(equations.(eqtag).optim_additive.params(i))*equations.(eqtag).optim_additive.scaling_factor(i);
elseif ~islogical(equations.(eqtag).optim_additive.bgp{i})
error('It is not possible to provide a value for the mean of an exogenous variable appearing in the optimal part of the PAC equation.')
end
end
cc = cc - gamma*tmp;
cc = cc - tmp0;
end
if gamma<1
if isfield(equations.(eqtag), 'non_optimizing_behaviour.params')
% Exogenous variables are present in the 1-λ part (rule of thumb agents).
tmp = 0;
tmp0 = 0;
tmp1 = 0;
for i=1:length(equations.(eqtag).non_optimizing_behaviour.params)
if isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && equations.(eqtag).non_optimizing_behaviour.bgp(i)
tmp = tmp + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.bgp(i);
elseif ~isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && equations.(eqtag).non_optimizing_behaviour.bgp(i)
tmp = tmp + DynareModel.params(equations.(eqtag).non_optimizing_behaviour.params(i))*equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.bgp(i);
if isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && equations.(eqtag).non_optimizing_behaviour.bgp{i}
tmp0 = tmp0 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i);
elseif ~isnan(equations.(eqtag).non_optimizing_behaviour.params(i)) && islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && equations.(eqtag).non_optimizing_behaviour.bgp{i}
tmp0 = tmp0 + DynareModel.params(equations.(eqtag).non_optimizing_behaviour.params(i))*equations.(eqtag).non_optimizing_behaviour.scaling_factor(i);
elseif ~islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnumeric(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnan(equations.(eqtag).non_optimizing_behaviour.params(i))
tmp1 = tmp1 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.bgp{i};
elseif ~islogical(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && isnumeric(equations.(eqtag).non_optimizing_behaviour.bgp{i}) && ~isnan(equations.(eqtag).non_optimizing_behaviour.params(i))
tmp1 = tmp1 + equations.(eqtag).non_optimizing_behaviour.scaling_factor(i)*equations.(eqtag).non_optimizing_behaviour.params(i)*equations.(eqtag).non_optimizing_behaviour.bgp{i};
end
end
cc = cc - (1.0-gamma)*tmp;
cc = cc - (1.0-gamma)*tmp0/gamma;
ll = -(1.0-gamma)*tmp1/gamma; % TODO: ll should be added as a constant in the PAC equation (under the λ part) when unrolling pac_expectation.
end
end
if isfield(equations.(eqtag), 'additive')
% Exogenous variables are present outside of the λ and (1-λ) parts (or we have exogenous variables in a "pure" PAC equation.
tmp = 0;
tmp0 = 0;
tmp1 = 0;
for i=1:length(equations.(eqtag).additive.params)
if isnan(equations.(eqtag).additive.params(i)) && equations.(eqtag).additive.bgp(i)
tmp = tmp + equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.bgp(i);
elseif ~isnan(equations.(eqtag).additive.params(i)) && equations.(eqtag).additive.bgp(i)
tmp = tmp + DynareModel.params(equations.(eqtag).additive.params(i))*equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.bgp(i);
if isnan(equations.(eqtag).additive.params(i)) && islogical(equations.(eqtag).additive.bgp{i}) && equations.(eqtag).additive.bgp{i}
tmp0 = tmp0 + equations.(eqtag).additive.scaling_factor(i);
elseif ~isnan(equations.(eqtag).additive.params(i)) && islogical(equations.(eqtag).additive.bgp{i}) && equations.(eqtag).additive.bgp{i}
tmp0 = tmp0 + DynareModel.params(equations.(eqtag).additive.params(i))*equations.(eqtag).additive.scaling_factor(i);
elseif ~islogical(equations.(eqtag).additive.bgp{i}) && isnumeric(equations.(eqtag).additive.bgp{i}) && isnan(equations.(eqtag).additive.params(i))
tmp1 = tmp1 + equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.bgp{i};
elseif ~islogical(equations.(eqtag).additive.bgp{i}) && isnumeric(equations.(eqtag).additive.bgp{i}) && ~isnan(equations.(eqtag).additive.params(i))
tmp1 = tmp1 + equations.(eqtag).additive.scaling_factor(i)*equations.(eqtag).additive.params(i)*equations.(eqtag).additive.bgp{i};
end
end
cc = cc - tmp;
cc = cc - tmp0/gamma;
ll = ll - tmp1/gamma; % TODO: ll should be added as a constant in the PAC equation (under the λ part) when unrolling pac_expectation.
end
DynareModel.params(pacmodel.growth_neutrality_param_index) = cc/gamma;
DynareModel.params(pacmodel.growth_neutrality_param_index) = cc; % Multiplies the variable or expression provided though the growth option in command pac_model.
end
end

View File

@ -8,7 +8,7 @@ function initialize(pacmodel)
% OUTPUTS
% None
% Copyright (C) 2018-2019 Dynare Team
% Copyright © 2018-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -37,12 +37,12 @@ end
% Append default bgp fields if needed.
for i=1:rows(M_.pac.(pacmodel).tag_map)
if isfield(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}), 'additive')
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).additive.bgp = false(1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).additive.params));
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).additive.bgp = repmat({false}, 1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).additive.params));
end
if isfield(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}), 'optim_additive')
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).optim_additive.bgp = false(1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).optim_additive.params));
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).optim_additive.bgp = repmat({false}, 1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).optim_additive.params));
end
if isfield(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}), 'non_optimizing_behaviour')
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).non_optimizing_behaviour.bgp = false(1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).non_optimizing_behaviour.params));
M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).non_optimizing_behaviour.bgp = repmat({false}, 1, length(M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{i,2}).non_optimizing_behaviour.params));
end
end

View File

@ -1,6 +1,6 @@
function dummy = get(pacmodel, paceq, kind, id)
% Copyright (C) 2019 Dynare Team
% Copyright © 2019-2021 Dynare Team
%
% This file is part of Dynare.
%
@ -19,4 +19,4 @@ function dummy = get(pacmodel, paceq, kind, id)
global M_
dummy = M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{strcmp(paceq, M_.pac.(pacmodel).tag_map(:,1)),2}).(kind).bgp(id);
dummy = M_.pac.(pacmodel).equations.(M_.pac.(pacmodel).tag_map{strcmp(paceq, M_.pac.(pacmodel).tag_map(:,1)),2}).(kind).bgp{id};

View File

@ -59,7 +59,7 @@ function [M_, done] = writebgpfield(type, pacmodel, eqtag, ide, xflag, nonzerome
done = false;
if isfield(M_.pac.(pacmodel).equations.(eqtag), type)
if ~isfield(M_.pac.(pacmodel).equations.(eqtag).additive, 'bgp')
M_.pac.(pacmodel).equations.(eqtag).(type).bgp = zeros(1, length(M_.pac.(pacmodel).equations.(eqtag).(type).params));
M_.pac.(pacmodel).equations.(eqtag).(type).bgp = repmat({false}, 1, length(M_.pac.(pacmodel).equations.(eqtag).(type).params));
end
[isvar, ie] = ismember(ide, M_.pac.(pacmodel).equations.(eqtag).(type).vars);
if isvar
@ -68,7 +68,7 @@ if isfield(M_.pac.(pacmodel).equations.(eqtag), type)
else
assert(M_.pac.(pacmodel).equations.(eqtag).(type).isendo(ie), 'Variable type issue.')
end
M_.pac.(pacmodel).equations.(eqtag).(type).bgp(ie) = nonzeromean;
M_.pac.(pacmodel).equations.(eqtag).(type).bgp{ie} = nonzeromean;
done = true;
end
end

View File

@ -36,7 +36,7 @@ c_z_2 = -.1;
c_z_dx2 = .3;
c_z_u = .3;
c_z_dv = .4;
c_z_s = -.2;
c_z_s = -.2;
cx = 1.0;
cy = 1.0;
@ -101,45 +101,117 @@ end;
pac.initialize('pacman');
// Exogenous variables with non zero mean:
pac.bgp.set('pacman', 'zpac', 's', .2);
pac.bgp.set('pacman', 'zpac', 'x', .2);
pac.bgp.set('pacman', 'zpac', 'dx2', .2);
pac.bgp.set('pacman', 'zpac', 's', true);
pac.bgp.set('pacman', 'zpac', 'x', .0);
pac.bgp.set('pacman', 'zpac', 'dx2', .0);
// Update the parameters of the PAC expectation model (h0 and h1 vectors, growth neutrality correction).
pac.update.expectation('pacman');
id = find(strcmp('s', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if ~pac.bgp.get('pacman', 'zpac', 'optim_additive', id)
error('bgp field in optim_additive for variable s is wrong.')
end
id = find(strcmp('s', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if ~pac.bgp.get('pacman', 'zpac', 'additive', id)
error('bgp field in additive is wrong.')
if ~isempty(id)
error('Variable s should not be under M_.pac.pacman.equations.eq0.additive.')
end
id = find(strcmp('s', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if ~isempty(id)
error('Variable s should not be under M_.pac.pacman.equations.eq0.non_optimizing_behaviour.')
end
id = find(strcmp('dv', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if pac.bgp.get('pacman', 'zpac', 'optim_additive', id)
error('bgp field in optim_additive for variable dv is wrong.')
end
id = find(strcmp('dv', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if pac.bgp.get('pacman', 'zpac', 'additive', id)
error('bgp field in additive is wrong.')
if ~isempty(id)
error('Variable dv should not be under M_.pac.pacman.equations.eq0.additive.')
end
id = find(strcmp('dv', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if ~isempty(id)
error('Variable dv should not be under M_.pac.pacman.equations.eq0.non_optimizing_behaviour.')
end
id = find(strcmp('x', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if ~pac.bgp.get('pacman', 'zpac', 'non_optimizing_behaviour', id)
error('bgp field in non_optimizing_behaviour is wrong.')
if ~(abs(pac.bgp.get('pacman', 'zpac', 'non_optimizing_behaviour', id))<1e-12)
error('bgp field in non_optimizing_behaviour for variable x is wrong.')
end
id = find(strcmp('x', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if ~isempty(id)
error('Variable x should not be under M_.pac.pacman.equations.eq0.optim_additive.')
end
id = find(strcmp('x', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if ~isempty(id)
error('Variable x should not be under M_.pac.pacman.equations.eq0.additive.')
end
id = find(strcmp('y', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if pac.bgp.get('pacman', 'zpac', 'non_optimizing_behaviour', id)
error('bgp field in non_optimizing_behaviour is wrong.')
if ~islogical(pac.bgp.get('pacman', 'zpac', 'non_optimizing_behaviour', id)) || pac.bgp.get('pacman', 'zpac', 'non_optimizing_behaviour', id)
error('bgp field in non_optimizing_behaviour for variable y is wrong.')
end
id = find(strcmp('y', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if ~isempty(id)
error('Variable y should not be under M_.pac.pacman.equations.eq0.optim_additive.')
end
id = find(strcmp('y', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if ~isempty(id)
error('Variable y should not be under M_.pac.pacman.equations.eq0.additive.')
end
id = find(strcmp('dx2', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if ~(abs(pac.bgp.get('pacman', 'zpac', 'additive', id))<1e-12)
error('bgp field in additive is wrong.')
end
id = find(strcmp('dx2', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if ~isempty(id)
error('Variable y should not be under M_.pac.pacman.equations.eq0.non_optimizing_behaviour.')
end
id = find(strcmp('dx2', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if ~pac.bgp.get('pacman', 'zpac', 'optim_additive', id)
error('bgp field in optim_additive is wrong.')
if ~isempty(id)
error('Variable dx2 should not be under M_.pac.pacman.equations.eq0.optim_additive.')
end
id = find(strcmp('u', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.additive.vars);
if pac.bgp.get('pacman', 'zpac', 'optim_additive', id)
error('bgp field in optim_additive is wrong.')
if ~islogical(pac.bgp.get('pacman', 'zpac', 'additive', id)) || pac.bgp.get('pacman', 'zpac', 'additive', id)
error('bgp field in additive for variable u is wrong.')
end
id = find(strcmp('u', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.non_optimizing_behaviour.vars);
if ~isempty(id)
error('Variable u should not be under M_.pac.pacman.equations.eq0.non_optimizing_behaviour.')
end
id = find(strcmp('u', M_.endo_names));
id = find(id==M_.pac.pacman.equations.eq0.optim_additive.vars);
if ~isempty(id)
error('Variable u should not be under M_.pac.pacman.equations.eq0.optim_additive.')
end