%
% Status : main Dynare file
%
% Warning : this file is generated automatically by Dynare
%           from model file (.mod)

if isoctave || matlab_ver_less_than('8.6')
    clear all
else
    clearvars -global
    clear_persistent_variables(fileparts(which('dynare')), false)
end
tic0 = tic;
% Save empty dates and dseries objects in memory.
dates('initialize');
dseries('initialize');
% Define global variables.
global M_ options_ oo_ estim_params_ bayestopt_ dataset_ dataset_info estimation_info ys0_ ex0_
options_ = [];
M_.fname = 'FiscalRE16022017_correct_tax';
M_.dynare_version = '4.5.7';
oo_.dynare_version = '4.5.7';
options_.dynare_version = '4.5.7';
%
% Some global variables initialization
%
global_initialization;
diary off;
diary('FiscalRE16022017_correct_tax.log');
M_.exo_names = 'gama_x';
M_.exo_names_tex = 'gama\_x';
M_.exo_names_long = 'gama_x';
M_.exo_names = char(M_.exo_names, 'gama_g');
M_.exo_names_tex = char(M_.exo_names_tex, 'gama\_g');
M_.exo_names_long = char(M_.exo_names_long, 'gama_g');
M_.endo_names = 'y';
M_.endo_names_tex = 'y';
M_.endo_names_long = 'y';
M_.endo_names = char(M_.endo_names, 'c');
M_.endo_names_tex = char(M_.endo_names_tex, 'c');
M_.endo_names_long = char(M_.endo_names_long, 'c');
M_.endo_names = char(M_.endo_names, 'H');
M_.endo_names_tex = char(M_.endo_names_tex, 'H');
M_.endo_names_long = char(M_.endo_names_long, 'H');
M_.endo_names = char(M_.endo_names, 'k');
M_.endo_names_tex = char(M_.endo_names_tex, 'k');
M_.endo_names_long = char(M_.endo_names_long, 'k');
M_.endo_names = char(M_.endo_names, 'inv');
M_.endo_names_tex = char(M_.endo_names_tex, 'inv');
M_.endo_names_long = char(M_.endo_names_long, 'inv');
M_.endo_names = char(M_.endo_names, 'rk');
M_.endo_names_tex = char(M_.endo_names_tex, 'rk');
M_.endo_names_long = char(M_.endo_names_long, 'rk');
M_.endo_names = char(M_.endo_names, 'w');
M_.endo_names_tex = char(M_.endo_names_tex, 'w');
M_.endo_names_long = char(M_.endo_names_long, 'w');
M_.endo_names = char(M_.endo_names, 'y_H');
M_.endo_names_tex = char(M_.endo_names_tex, 'y\_H');
M_.endo_names_long = char(M_.endo_names_long, 'y_H');
M_.endo_names = char(M_.endo_names, 'r');
M_.endo_names_tex = char(M_.endo_names_tex, 'r');
M_.endo_names_long = char(M_.endo_names_long, 'r');
M_.endo_names = char(M_.endo_names, 'U');
M_.endo_names_tex = char(M_.endo_names_tex, 'U');
M_.endo_names_long = char(M_.endo_names_long, 'U');
M_.endo_names = char(M_.endo_names, 'a');
M_.endo_names_tex = char(M_.endo_names_tex, 'a');
M_.endo_names_long = char(M_.endo_names_long, 'a');
M_.endo_names = char(M_.endo_names, 'b');
M_.endo_names_tex = char(M_.endo_names_tex, 'b');
M_.endo_names_long = char(M_.endo_names_long, 'b');
M_.endo_names = char(M_.endo_names, 'g');
M_.endo_names_tex = char(M_.endo_names_tex, 'g');
M_.endo_names_long = char(M_.endo_names_long, 'g');
M_.endo_names = char(M_.endo_names, 'gy');
M_.endo_names_tex = char(M_.endo_names_tex, 'gy');
M_.endo_names_long = char(M_.endo_names_long, 'gy');
M_.endo_names = char(M_.endo_names, 'by');
M_.endo_names_tex = char(M_.endo_names_tex, 'by');
M_.endo_names_long = char(M_.endo_names_long, 'by');
M_.endo_partitions = struct();
M_.param_names = 'eps_H';
M_.param_names_tex = 'eps\_H';
M_.param_names_long = 'eps_H';
M_.param_names = char(M_.param_names, 'sigma');
M_.param_names_tex = char(M_.param_names_tex, 'sigma');
M_.param_names_long = char(M_.param_names_long, 'sigma');
M_.param_names = char(M_.param_names, 'psi');
M_.param_names_tex = char(M_.param_names_tex, 'psi');
M_.param_names_long = char(M_.param_names_long, 'psi');
M_.param_names = char(M_.param_names, 'cy_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'cy\_ratio');
M_.param_names_long = char(M_.param_names_long, 'cy_ratio');
M_.param_names = char(M_.param_names, 'iy_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'iy\_ratio');
M_.param_names_long = char(M_.param_names_long, 'iy_ratio');
M_.param_names = char(M_.param_names, 'gy_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'gy\_ratio');
M_.param_names_long = char(M_.param_names_long, 'gy_ratio');
M_.param_names = char(M_.param_names, 'alpha');
M_.param_names_tex = char(M_.param_names_tex, 'alpha');
M_.param_names_long = char(M_.param_names_long, 'alpha');
M_.param_names = char(M_.param_names, 'delta');
M_.param_names_tex = char(M_.param_names_tex, 'delta');
M_.param_names_long = char(M_.param_names_long, 'delta');
M_.param_names = char(M_.param_names, 'theta');
M_.param_names_tex = char(M_.param_names_tex, 'theta');
M_.param_names_long = char(M_.param_names_long, 'theta');
M_.param_names = char(M_.param_names, 'gama');
M_.param_names_tex = char(M_.param_names_tex, 'gama');
M_.param_names_long = char(M_.param_names_long, 'gama');
M_.param_names = char(M_.param_names, 'ik_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'ik\_ratio');
M_.param_names_long = char(M_.param_names_long, 'ik_ratio');
M_.param_names = char(M_.param_names, 'beta');
M_.param_names_tex = char(M_.param_names_tex, 'beta');
M_.param_names_long = char(M_.param_names_long, 'beta');
M_.param_names = char(M_.param_names, 'Rbar');
M_.param_names_tex = char(M_.param_names_tex, 'Rbar');
M_.param_names_long = char(M_.param_names_long, 'Rbar');
M_.param_names = char(M_.param_names, 'ay_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'ay\_ratio');
M_.param_names_long = char(M_.param_names_long, 'ay_ratio');
M_.param_names = char(M_.param_names, 'by_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'by\_ratio');
M_.param_names_long = char(M_.param_names_long, 'by_ratio');
M_.param_names = char(M_.param_names, 'tauk');
M_.param_names_tex = char(M_.param_names_tex, 'tauk');
M_.param_names_long = char(M_.param_names_long, 'tauk');
M_.param_names = char(M_.param_names, 'ky_ratio');
M_.param_names_tex = char(M_.param_names_tex, 'ky\_ratio');
M_.param_names_long = char(M_.param_names_long, 'ky_ratio');
M_.param_names = char(M_.param_names, 'tauH');
M_.param_names_tex = char(M_.param_names_tex, 'tauH');
M_.param_names_long = char(M_.param_names_long, 'tauH');
M_.param_names = char(M_.param_names, 'tauC');
M_.param_names_tex = char(M_.param_names_tex, 'tauC');
M_.param_names_long = char(M_.param_names_long, 'tauC');
M_.param_names = char(M_.param_names, 'lam1');
M_.param_names_tex = char(M_.param_names_tex, 'lam1');
M_.param_names_long = char(M_.param_names_long, 'lam1');
M_.param_names = char(M_.param_names, 'lam2');
M_.param_names_tex = char(M_.param_names_tex, 'lam2');
M_.param_names_long = char(M_.param_names_long, 'lam2');
M_.param_names = char(M_.param_names, 'sigma_x');
M_.param_names_tex = char(M_.param_names_tex, 'sigma\_x');
M_.param_names_long = char(M_.param_names_long, 'sigma_x');
M_.param_names = char(M_.param_names, 'sigma_g');
M_.param_names_tex = char(M_.param_names_tex, 'sigma\_g');
M_.param_names_long = char(M_.param_names_long, 'sigma_g');
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 2;
M_.endo_nbr = 15;
M_.param_nbr = 23;
M_.orig_endo_nbr = 15;
M_.aux_vars = [];
M_.Sigma_e = zeros(2, 2);
M_.Correlation_matrix = eye(2, 2);
M_.H = 0;
M_.Correlation_matrix_ME = 1;
M_.sigma_e_is_diagonal = 1;
M_.det_shocks = [];
options_.linear = 1;
options_.block=0;
options_.bytecode=0;
options_.use_dll=0;
M_.hessian_eq_zero = 1;
erase_compiled_function('FiscalRE16022017_correct_tax_static');
erase_compiled_function('FiscalRE16022017_correct_tax_dynamic');
M_.orig_eq_nbr = 15;
M_.eq_nbr = 15;
M_.ramsey_eq_nbr = 0;
M_.set_auxiliary_variables = exist(['./' M_.fname '_set_auxiliary_variables.m'], 'file') == 2;
M_.lead_lag_incidence = [
 0 3 0;
 0 4 18;
 0 5 19;
 1 6 0;
 0 7 0;
 0 8 20;
 0 9 0;
 0 10 0;
 0 11 0;
 0 12 0;
 0 13 0;
 2 14 0;
 0 15 0;
 0 16 0;
 0 17 0;]';
M_.nstatic = 10;
M_.nfwrd   = 3;
M_.npred   = 2;
M_.nboth   = 0;
M_.nsfwrd   = 3;
M_.nspred   = 2;
M_.ndynamic   = 5;
M_.equations_tags = {
};
M_.static_and_dynamic_models_differ = 0;
M_.exo_names_orig_ord = [1:2];
M_.maximum_lag = 1;
M_.maximum_lead = 1;
M_.maximum_endo_lag = 1;
M_.maximum_endo_lead = 1;
oo_.steady_state = zeros(15, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(2, 1);
M_.params = NaN(23, 1);
M_.NNZDerivatives = [61; -1; -1];
beta_tilda = 0.992;
M_.params( 10 ) = 1.010302711192637;
gama = M_.params( 10 );
M_.params( 13 ) = M_.params(10)/beta_tilda;
Rbar = M_.params( 13 );
M_.params( 8 ) = 0.01525;
delta = M_.params( 8 );
M_.params( 7 ) = 0.40;
alpha = M_.params( 7 );
M_.params( 1 ) = 0.1;
eps_H = M_.params( 1 );
M_.params( 2 ) = 2;
sigma = M_.params( 2 );
M_.params( 16 ) = 0.16;
tauk = M_.params( 16 );
M_.params( 18 ) = 0.41;
tauH = M_.params( 18 );
M_.params( 19 ) = 0.15;
tauC = M_.params( 19 );
M_.params( 6 ) = 0.20;
gy_ratio = M_.params( 6 );
M_.params( 9 ) = 1+(M_.params(13)-1)/(1-M_.params(16))/M_.params(8);
theta = M_.params( 9 );
M_.params( 17 ) = M_.params(10)*M_.params(7)/((M_.params(13)-1)/(1-M_.params(16))+M_.params(8));
ky_ratio = M_.params( 17 );
M_.params( 11 ) = 1-(1-M_.params(8))/M_.params(10);
ik_ratio = M_.params( 11 );
M_.params( 5 ) = M_.params(17)*M_.params(11);
iy_ratio = M_.params( 5 );
M_.params( 15 ) = 1;
by_ratio = M_.params( 15 );
M_.params( 4 ) = 1-M_.params(5)-M_.params(6);
cy_ratio = M_.params( 4 );
M_.params( 3 ) = (1-M_.params(7))/M_.params(4)*(1-M_.params(18))/(1+M_.params(19));
psi = M_.params( 3 );
M_.params( 14 ) = M_.params(17)+M_.params(15);
ay_ratio = M_.params( 14 );
M_.params( 20 ) = 0;
lam1 = M_.params( 20 );
M_.params( 21 ) = (-0.02);
lam2 = M_.params( 21 );
M_.params( 12 ) = M_.params(10)^M_.params(2)/M_.params(13);
beta = M_.params( 12 );
M_.params( 22 ) = 0.003;
sigma_x = M_.params( 22 );
M_.params( 23 ) = 0.003;
sigma_g = M_.params( 23 );
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = M_.params(22)^2;
M_.Sigma_e(2, 2) = M_.params(23)^2;
options_.hp_filter = 1600;
options_.irf = 60;
options_.order = 1;
var_list_ = char();
info = stoch_simul(var_list_);
coeff_k = oo_.dr.ghx;
coeff_u = oo_.dr.ghu;
save('coeff_k','coeff_k');
save('coeff_u','coeff_u');
save('FiscalRE16022017_correct_tax_results.mat', 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save('FiscalRE16022017_correct_tax_results.mat', 'oo_recursive_', '-append');
end


disp(['Total computing time : ' dynsec2hms(toc(tic0)) ]);
if ~isempty(lastwarn)
  disp('Note: warning(s) encountered in MATLAB/Octave code')
end
diary off
