%
% 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 = 'Multibis';
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('Multibis.log');
M_.exo_names = 'eps_A';
M_.exo_names_tex = 'eps\_A';
M_.exo_names_long = 'eps_A';
M_.exo_names = char(M_.exo_names, 'eps_B');
M_.exo_names_tex = char(M_.exo_names_tex, 'eps\_B');
M_.exo_names_long = char(M_.exo_names_long, 'eps_B');
M_.endo_names = 'L_A';
M_.endo_names_tex = 'L\_A';
M_.endo_names_long = 'L_A';
M_.endo_names = char(M_.endo_names, 'L_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'L\_B');
M_.endo_names_long = char(M_.endo_names_long, 'L_B');
M_.endo_names = char(M_.endo_names, 'Y_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'Y\_A');
M_.endo_names_long = char(M_.endo_names_long, 'Y_A');
M_.endo_names = char(M_.endo_names, 'Y_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'Y\_B');
M_.endo_names_long = char(M_.endo_names_long, 'Y_B');
M_.endo_names = char(M_.endo_names, 'W_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'W\_A');
M_.endo_names_long = char(M_.endo_names_long, 'W_A');
M_.endo_names = char(M_.endo_names, 'W_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'W\_B');
M_.endo_names_long = char(M_.endo_names_long, 'W_B');
M_.endo_names = char(M_.endo_names, 'P_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'P\_A');
M_.endo_names_long = char(M_.endo_names_long, 'P_A');
M_.endo_names = char(M_.endo_names, 'P_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'P\_B');
M_.endo_names_long = char(M_.endo_names_long, 'P_B');
M_.endo_names = char(M_.endo_names, 'e_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'e\_A');
M_.endo_names_long = char(M_.endo_names_long, 'e_A');
M_.endo_names = char(M_.endo_names, 'e_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'e\_B');
M_.endo_names_long = char(M_.endo_names_long, 'e_B');
M_.endo_names = char(M_.endo_names, 'K_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'K\_A');
M_.endo_names_long = char(M_.endo_names_long, 'K_A');
M_.endo_names = char(M_.endo_names, 'K_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'K\_B');
M_.endo_names_long = char(M_.endo_names_long, 'K_B');
M_.endo_names = char(M_.endo_names, 'C_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'C\_A');
M_.endo_names_long = char(M_.endo_names_long, 'C_A');
M_.endo_names = char(M_.endo_names, 'C_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'C\_B');
M_.endo_names_long = char(M_.endo_names_long, 'C_B');
M_.endo_names = char(M_.endo_names, 'I_A');
M_.endo_names_tex = char(M_.endo_names_tex, 'I\_A');
M_.endo_names_long = char(M_.endo_names_long, 'I_A');
M_.endo_names = char(M_.endo_names, 'I_B');
M_.endo_names_tex = char(M_.endo_names_tex, 'I\_B');
M_.endo_names_long = char(M_.endo_names_long, 'I_B');
M_.endo_names = char(M_.endo_names, 'M_AA');
M_.endo_names_tex = char(M_.endo_names_tex, 'M\_AA');
M_.endo_names_long = char(M_.endo_names_long, 'M_AA');
M_.endo_names = char(M_.endo_names, 'M_BB');
M_.endo_names_tex = char(M_.endo_names_tex, 'M\_BB');
M_.endo_names_long = char(M_.endo_names_long, 'M_BB');
M_.endo_names = char(M_.endo_names, 'M_BA');
M_.endo_names_tex = char(M_.endo_names_tex, 'M\_BA');
M_.endo_names_long = char(M_.endo_names_long, 'M_BA');
M_.endo_names = char(M_.endo_names, 'M_AB');
M_.endo_names_tex = char(M_.endo_names_tex, 'M\_AB');
M_.endo_names_long = char(M_.endo_names_long, 'M_AB');
M_.endo_partitions = struct();
M_.param_names = 'PHI_A';
M_.param_names_tex = 'PHI\_A';
M_.param_names_long = 'PHI_A';
M_.param_names = char(M_.param_names, 'PHI_B');
M_.param_names_tex = char(M_.param_names_tex, 'PHI\_B');
M_.param_names_long = char(M_.param_names_long, 'PHI_B');
M_.param_names = char(M_.param_names, 'GAMMA_AA');
M_.param_names_tex = char(M_.param_names_tex, 'GAMMA\_AA');
M_.param_names_long = char(M_.param_names_long, 'GAMMA_AA');
M_.param_names = char(M_.param_names, 'GAMMA_BB');
M_.param_names_tex = char(M_.param_names_tex, 'GAMMA\_BB');
M_.param_names_long = char(M_.param_names_long, 'GAMMA_BB');
M_.param_names = char(M_.param_names, 'GAMMA_BA');
M_.param_names_tex = char(M_.param_names_tex, 'GAMMA\_BA');
M_.param_names_long = char(M_.param_names_long, 'GAMMA_BA');
M_.param_names = char(M_.param_names, 'GAMMA_AB');
M_.param_names_tex = char(M_.param_names_tex, 'GAMMA\_AB');
M_.param_names_long = char(M_.param_names_long, 'GAMMA_AB');
M_.param_names = char(M_.param_names, 'ALPHA_A');
M_.param_names_tex = char(M_.param_names_tex, 'ALPHA\_A');
M_.param_names_long = char(M_.param_names_long, 'ALPHA_A');
M_.param_names = char(M_.param_names, 'ALPHA_B');
M_.param_names_tex = char(M_.param_names_tex, 'ALPHA\_B');
M_.param_names_long = char(M_.param_names_long, 'ALPHA_B');
M_.param_names = char(M_.param_names, 'BETA_A');
M_.param_names_tex = char(M_.param_names_tex, 'BETA\_A');
M_.param_names_long = char(M_.param_names_long, 'BETA_A');
M_.param_names = char(M_.param_names, 'BETA_B');
M_.param_names_tex = char(M_.param_names_tex, 'BETA\_B');
M_.param_names_long = char(M_.param_names_long, 'BETA_B');
M_.param_names = char(M_.param_names, 'OMEGA');
M_.param_names_tex = char(M_.param_names_tex, 'OMEGA');
M_.param_names_long = char(M_.param_names_long, 'OMEGA');
M_.param_names = char(M_.param_names, 'MU');
M_.param_names_tex = char(M_.param_names_tex, 'MU');
M_.param_names_long = char(M_.param_names_long, 'MU');
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, '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, '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, 'DELT');
M_.param_names_tex = char(M_.param_names_tex, 'DELT');
M_.param_names_long = char(M_.param_names_long, 'DELT');
M_.param_names = char(M_.param_names, 'DELTT');
M_.param_names_tex = char(M_.param_names_tex, 'DELTT');
M_.param_names_long = char(M_.param_names_long, 'DELTT');
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 2;
M_.endo_nbr = 20;
M_.param_nbr = 17;
M_.orig_endo_nbr = 20;
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_.block=0;
options_.bytecode=0;
options_.use_dll=0;
M_.hessian_eq_zero = 1;
erase_compiled_function('Multibis_static');
erase_compiled_function('Multibis_dynamic');
M_.orig_eq_nbr = 20;
M_.eq_nbr = 20;
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 0;
 0 5 23;
 0 6 24;
 0 7 0;
 0 8 0;
 0 9 25;
 0 10 26;
 1 11 0;
 2 12 0;
 0 13 27;
 0 14 28;
 0 15 0;
 0 16 0;
 0 17 0;
 0 18 0;
 0 19 0;
 0 20 0;
 0 21 0;
 0 22 0;]';
M_.nstatic = 12;
M_.nfwrd   = 6;
M_.npred   = 2;
M_.nboth   = 0;
M_.nsfwrd   = 6;
M_.nspred   = 2;
M_.ndynamic   = 8;
M_.equations_tags = {
  1 , 'name' , 'consumption final goods A' ;
  2 , 'name' , 'consumption final goods B' ;
  3 , 'name' , 'labor supply for sector A' ;
  4 , 'name' , 'labor supply for sector B' ;
  5 , 'name' , 'labor demand for sector A' ;
  6 , 'name' , 'labor demand for sector B' ;
  7 , 'name' , 'Input need of sector A from sector A' ;
  8 , 'name' , 'Input need of sector A from sector B' ;
  9 , 'name' , 'Input need of sector B from sector A' ;
  10 , 'name' , 'Input need of sector B from sector B' ;
  11 , 'name' , 'Capital need for sector A' ;
  12 , 'name' , 'Capital need for sector B' ;
  13 , 'name' , 'Law of motion for sector A' ;
  14 , 'name' , 'Law of motion for sector B' ;
  15 , 'name' , 'Resource constraint in output A' ;
  16 , 'name' , 'Resource constraint in output B' ;
  17 , 'name' , 'Production function of sector A' ;
  18 , 'name' , 'Production function of sector B' ;
  19 , 'name' , 'Sector A TFP shock' ;
  20 , 'name' , 'Sector B TFP shock' ;
};
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(20, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(2, 1);
M_.params = NaN(17, 1);
M_.NNZDerivatives = [78; -1; -1];
close all;
M_.params( 1 ) = .5;
PHI_A = M_.params( 1 );
M_.params( 2 ) = .5;
PHI_B = M_.params( 2 );
M_.params( 16 ) = 0.987;
DELT = M_.params( 16 );
M_.params( 17 ) = 0.02;
DELTT = M_.params( 17 );
M_.params( 7 ) = .3;
ALPHA_A = M_.params( 7 );
M_.params( 8 ) = .3;
ALPHA_B = M_.params( 8 );
M_.params( 9 ) = 0.2;
BETA_A = M_.params( 9 );
M_.params( 10 ) = 0.2;
BETA_B = M_.params( 10 );
M_.params( 3 ) = .3;
GAMMA_AA = M_.params( 3 );
M_.params( 5 ) = .2;
GAMMA_BA = M_.params( 5 );
M_.params( 4 ) = .3;
GAMMA_BB = M_.params( 4 );
M_.params( 6 ) = .2;
GAMMA_AB = M_.params( 6 );
M_.params( 13 ) = 1.2;
PSI = M_.params( 13 );
M_.params( 12 ) = 1.2;
MU = M_.params( 12 );
M_.params( 11 ) = (-0.9);
OMEGA = M_.params( 11 );
M_.params( 14 ) = 0.99;
SIGMA = M_.params( 14 );
M_.params( 15 ) = 0.97;
RHO = M_.params( 15 );
resid(1);
oo_.dr.eigval = check(M_,options_,oo_);
steady;
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = (0.001)^2;
M_.Sigma_e(2, 2) = (0.001)^2;
options_.order = 1;
options_.periods = 1000;
var_list_ = char();
info = stoch_simul(var_list_);
save('Multibis_results.mat', 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save('Multibis_results.mat', 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save('Multibis_results.mat', 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save('Multibis_results.mat', 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save('Multibis_results.mat', 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save('Multibis_results.mat', 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save('Multibis_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
