Commit 944bf2b6 authored by Johannes Pfeifer's avatar Johannes Pfeifer
Browse files

occbin: work with non-demeaned data and in constraints

parent c4e1d1e8
Pipeline #5669 passed with stages
in 82 minutes and 45 seconds
......@@ -167,7 +167,7 @@ for shock_period = 1:n_shocks_periods
regime_start(end)-1,binding_indicator,...
data.exo_pos,data.shocks_sequence(shock_period,:),endo_init,update_flag);
[binding, relax, err]=feval([M_.fname,'.occbin_difference'],zdatalinear_,M_.params,dr_base.ys);
[binding, relax, err]=feval([M_.fname,'.occbin_difference'],zdatalinear_+repmat(dr_base.ys',size(zdatalinear_,1),1),M_.params,dr_base.ys);
% check if changes to the hypothesis of the duration for each
% regime
......
......@@ -145,7 +145,7 @@ for shock_period = 1:n_shocks_periods
while (regime_change_this_iteration && iter<max_iter && ~is_periodic)
iter = iter +1;
if any(binding_indicator(end,:)) && nperiods_0<opts_simul_.max_periods
binding_indicator = [binding_indicator; false(2,1)];
binding_indicator = [binding_indicator; false(1,2)];
nperiods_0 = nperiods_0 + 1;
disp_verbose(['nperiods has been endogenously increased up to ' int2str(nperiods_0) '.'],opts_simul_.debug)
end
......@@ -183,7 +183,7 @@ for shock_period = 1:n_shocks_periods
binding_indicator,...
data.exo_pos,data.shocks_sequence(shock_period,:),endo_init, update_flag);
[binding, relax, err]=feval([M_.fname,'.occbin_difference'],zdatalinear_,M_.params,dr.ys);
[binding, relax, err]=feval([M_.fname,'.occbin_difference'],zdatalinear_+repmat(dr.ys',size(zdatalinear_,1),1),M_.params,dr.ys);
binding_constraint_new=[binding.constraint_1;binding.constraint_2];
relaxed_constraint_new = [relax.constraint_1;relax.constraint_2];
......
......@@ -207,7 +207,7 @@ model;
end;
occbin_constraints;
name 'zlb'; bind inom+inombar <= inomlb; relax inom+inombar > inomlb;
name 'zlb'; bind inom <= inomlb; relax inom > inomlb;
end;
// ---------------- Steady state -----------------------------------------//
......
......@@ -209,7 +209,7 @@ model;
end;
occbin_constraints;
name 'zlb'; bind inom+inombar <= inomlb; relax inom+inombar > inomlb;
name 'zlb'; bind inom <= inomlb; relax inom > inomlb;
end;
// ---------------- Steady state -----------------------------------------//
......
......@@ -29,7 +29,7 @@ y_hat = log(y) - log(steady_state(y));
end;
occbin_constraints;
name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
name 'borrcon'; bind lb<0; relax b>M*y; error_bind abs(lb); error_relax abs(b-M*y);
%name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y;
end;
......
......@@ -30,7 +30,7 @@ y_hat = log(y) - log(steady_state(y));
end;
occbin_constraints;
name 'borrcon'; bind lb<-STEADY_STATE(lb); relax b>M*y; error_bind abs(lb+STEADY_STATE(lb)); error_relax abs(b-M*y);
name 'borrcon'; bind lb<0; relax b>M*y; error_bind abs(lb); error_relax abs(b-M*y);
end;
steady_state_model;
......
......@@ -53,8 +53,8 @@ a = RHOA*a(-1)+erra;
end;
occbin_constraints;
name 'IRR'; bind i<PHI-1; relax lambdak<0;
name 'INEG'; bind i<-0.000001;
name 'IRR'; bind i-steady_state(i)<log(PHI); relax lambdak<0;
name 'INEG'; bind i-steady_state(i)<-0.000001;
end;
@#include "dynrbc_common.inc"
......@@ -53,8 +53,8 @@ a = RHOA*a(-1)+erra;
end;
occbin_constraints;
name 'IRR'; bind i<PHI-1; relax lambdak<0; error_bind abs(i-(PHI-1)); error_relax abs(lambdak-0);
name 'INEG'; bind i<-0.000001; relax i>-0.000001; error_bind abs(i-0.000001); error_relax abs(i-0.000001);
name 'IRR'; bind i-steady_state(i)<log(PHI); relax lambdak<0; error_bind abs(i-steady_state(i)-log(PHI)); error_relax abs(lambdak-0);
name 'INEG'; bind i-steady_state(i)<-0.000001; relax i-steady_state(i)>-0.000001; error_bind abs(i-steady_state(i)-0.000001); error_relax abs(i-steady_state(i)-0.000001);
end;
@#include "dynrbc_common.inc"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment