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

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 = 'fe';
M_.dynare_version = '4.5.4';
oo_.dynare_version = '4.5.4';
options_.dynare_version = '4.5.4';
%
% Some global variables initialization
%
global_initialization;
diary off;
M_.exo_names = 'eps_u';
M_.exo_names_tex = 'eps\_u';
M_.exo_names_long = 'eps_u';
M_.exo_names = char(M_.exo_names, 'eps_rn');
M_.exo_names_tex = char(M_.exo_names_tex, 'eps\_rn');
M_.exo_names_long = char(M_.exo_names_long, 'eps_rn');
M_.endo_names = 'Epi';
M_.endo_names_tex = 'Epi';
M_.endo_names_long = 'Epi';
M_.endo_names = char(M_.endo_names, 'pi');
M_.endo_names_tex = char(M_.endo_names_tex, 'pi');
M_.endo_names_long = char(M_.endo_names_long, 'pi');
M_.endo_names = char(M_.endo_names, 'y');
M_.endo_names_tex = char(M_.endo_names_tex, 'y');
M_.endo_names_long = char(M_.endo_names_long, 'y');
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, 'rn');
M_.endo_names_tex = char(M_.endo_names_tex, 'rn');
M_.endo_names_long = char(M_.endo_names_long, 'rn');
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, 'yre');
M_.endo_names_tex = char(M_.endo_names_tex, 'yre');
M_.endo_names_long = char(M_.endo_names_long, 'yre');
M_.endo_names = char(M_.endo_names, 'pire');
M_.endo_names_tex = char(M_.endo_names_tex, 'pire');
M_.endo_names_long = char(M_.endo_names_long, 'pire');
M_.endo_names = char(M_.endo_names, 'rre');
M_.endo_names_tex = char(M_.endo_names_tex, 'rre');
M_.endo_names_long = char(M_.endo_names_long, 'rre');
M_.endo_names = char(M_.endo_names, 'pireexp');
M_.endo_names_tex = char(M_.endo_names_tex, 'pireexp');
M_.endo_names_long = char(M_.endo_names_long, 'pireexp');
M_.endo_names = char(M_.endo_names, 'i');
M_.endo_names_tex = char(M_.endo_names_tex, 'i');
M_.endo_names_long = char(M_.endo_names_long, 'i');
M_.endo_names = char(M_.endo_names, 'ire');
M_.endo_names_tex = char(M_.endo_names_tex, 'ire');
M_.endo_names_long = char(M_.endo_names_long, 'ire');
M_.endo_names = char(M_.endo_names, 'piexp');
M_.endo_names_tex = char(M_.endo_names_tex, 'piexp');
M_.endo_names_long = char(M_.endo_names_long, 'piexp');
M_.endo_names = char(M_.endo_names, 'yexp');
M_.endo_names_tex = char(M_.endo_names_tex, 'yexp');
M_.endo_names_long = char(M_.endo_names_long, 'yexp');
M_.endo_names = char(M_.endo_names, 'ferr');
M_.endo_names_tex = char(M_.endo_names_tex, 'ferr');
M_.endo_names_long = char(M_.endo_names_long, 'ferr');
M_.endo_partitions = struct();
M_.param_names = 'beta';
M_.param_names_tex = 'beta';
M_.param_names_long = 'beta';
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, 'phi_pi');
M_.param_names_tex = char(M_.param_names_tex, 'phi\_pi');
M_.param_names_long = char(M_.param_names_long, 'phi_pi');
M_.param_names = char(M_.param_names, 'phi_y');
M_.param_names_tex = char(M_.param_names_tex, 'phi\_y');
M_.param_names_long = char(M_.param_names_long, 'phi_y');
M_.param_names = char(M_.param_names, 'sig_rn');
M_.param_names_tex = char(M_.param_names_tex, 'sig\_rn');
M_.param_names_long = char(M_.param_names_long, 'sig_rn');
M_.param_names = char(M_.param_names, 'sig_u');
M_.param_names_tex = char(M_.param_names_tex, 'sig\_u');
M_.param_names_long = char(M_.param_names_long, 'sig_u');
M_.param_names = char(M_.param_names, 'rho_u');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_u');
M_.param_names_long = char(M_.param_names_long, 'rho_u');
M_.param_names = char(M_.param_names, 'rho_rn');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_rn');
M_.param_names_long = char(M_.param_names_long, 'rho_rn');
M_.param_names = char(M_.param_names, 'rho');
M_.param_names_tex = char(M_.param_names_tex, 'rho');
M_.param_names_long = char(M_.param_names_long, 'rho');
M_.param_names = char(M_.param_names, 'gamma');
M_.param_names_tex = char(M_.param_names_tex, 'gamma');
M_.param_names_long = char(M_.param_names_long, 'gamma');
M_.param_names = char(M_.param_names, 'k');
M_.param_names_tex = char(M_.param_names_tex, 'k');
M_.param_names_long = char(M_.param_names_long, 'k');
M_.param_names = char(M_.param_names, 'lb');
M_.param_names_tex = char(M_.param_names_tex, 'lb');
M_.param_names_long = char(M_.param_names_long, 'lb');
M_.param_names = char(M_.param_names, 'rn_steady');
M_.param_names_tex = char(M_.param_names_tex, 'rn\_steady');
M_.param_names_long = char(M_.param_names_long, 'rn_steady');
M_.param_names = char(M_.param_names, 'rho_i');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_i');
M_.param_names_long = char(M_.param_names_long, 'rho_i');
M_.param_names = char(M_.param_names, 'rho_pi');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_pi');
M_.param_names_long = char(M_.param_names_long, 'rho_pi');
M_.param_names = char(M_.param_names, 'gamma_zlb');
M_.param_names_tex = char(M_.param_names_tex, 'gamma\_zlb');
M_.param_names_long = char(M_.param_names_long, 'gamma_zlb');
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 2;
M_.endo_nbr = 15;
M_.param_nbr = 16;
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('fe_static');
erase_compiled_function('fe_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 = [
 1 5 0;
 0 6 20;
 0 7 21;
 0 8 0;
 2 9 0;
 0 10 0;
 0 11 22;
 0 12 23;
 0 13 0;
 0 14 0;
 3 15 0;
 4 16 0;
 0 17 0;
 0 18 0;
 0 19 0;]';
M_.nstatic = 7;
M_.nfwrd   = 4;
M_.npred   = 4;
M_.nboth   = 0;
M_.nsfwrd   = 4;
M_.nspred   = 4;
M_.ndynamic   = 8;
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(16, 1);
M_.NNZDerivatives = [49; 0; 0];
M_.params( 13 ) = 1;
rn_steady = M_.params( 13 );
M_.params( 1 ) = 1/(1+M_.params(13)/400);
beta = M_.params( 1 );
M_.params( 2 ) = 1;
psi = M_.params( 2 );
M_.params( 14 ) = 0.7;
rho_i = M_.params( 14 );
M_.params( 3 ) = 2;
phi_pi = M_.params( 3 );
M_.params( 4 ) = .5;
phi_y = M_.params( 4 );
M_.params( 5 ) = 0.002940;
sig_rn = M_.params( 5 );
M_.params( 6 ) = 0.00154;
sig_u = M_.params( 6 );
M_.params( 8 ) = 0.8;
rho_rn = M_.params( 8 );
M_.params( 9 ) = 0.948;
rho = M_.params( 9 );
M_.params( 7 ) = 0;
rho_u = M_.params( 7 );
M_.params( 11 ) = 0.057;
k = M_.params( 11 );
M_.params( 12 ) = 0.007;
lb = M_.params( 12 );
M_.params( 15 ) = 0.95;
rho_pi = M_.params( 15 );
M_.params( 10 ) = Gamma;
gamma = M_.params( 10 );
M_.params( 16 ) = 0.3;
gamma_zlb = M_.params( 16 );
resid;
steady;
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = (M_.params(6))^2;
M_.Sigma_e(2, 2) = (M_.params(5))^2;
rand('seed',122); randn('seed',123);
options_.k_order_solver = 1;
options_.irf = 0;
options_.noprint = 0;
options_.order = 3;
options_.periods = 10000;
var_list_ = char();
info = stoch_simul(var_list_);
save('fe_results.mat', 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save('fe_results.mat', 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save('fe_results.mat', 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save('fe_results.mat', 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save('fe_results.mat', 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save('fe_results.mat', 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save('fe_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
