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

tic;
global M_ oo_ options_ ys0_ ex0_ estimation_info
options_ = [];
M_.fname = 'BankCapital';
%
% Some global variables initialization
%
global_initialization;
diary off;
diary('BankCapital.log');
M_.exo_names = 'z_shk';
M_.exo_names_tex = 'z\_shk';
M_.exo_names_long = 'z_shk';
M_.exo_names = char(M_.exo_names, 'mp_shk');
M_.exo_names_tex = char(M_.exo_names_tex, 'mp\_shk');
M_.exo_names_long = char(M_.exo_names_long, 'mp_shk');
M_.exo_names = char(M_.exo_names, 'bk_shk');
M_.exo_names_tex = char(M_.exo_names_tex, 'bk\_shk');
M_.exo_names_long = char(M_.exo_names_long, 'bk_shk');
M_.endo_names = 'ch';
M_.endo_names_tex = 'ch';
M_.endo_names_long = 'ch';
M_.endo_names = char(M_.endo_names, 'Ce');
M_.endo_names_tex = char(M_.endo_names_tex, 'Ce');
M_.endo_names_long = char(M_.endo_names_long, 'Ce');
M_.endo_names = char(M_.endo_names, 'Cb');
M_.endo_names_tex = char(M_.endo_names_tex, 'Cb');
M_.endo_names_long = char(M_.endo_names_long, 'Cb');
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, '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, '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, 'bigN');
M_.endo_names_tex = char(M_.endo_names_tex, 'bigN');
M_.endo_names_long = char(M_.endo_names_long, 'bigN');
M_.endo_names = char(M_.endo_names, 'bigA');
M_.endo_names_tex = char(M_.endo_names_tex, 'bigA');
M_.endo_names_long = char(M_.endo_names_long, 'bigA');
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, 'q');
M_.endo_names_tex = char(M_.endo_names_tex, 'q');
M_.endo_names_long = char(M_.endo_names_long, 'q');
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, 'infl');
M_.endo_names_tex = char(M_.endo_names_tex, 'infl');
M_.endo_names_long = char(M_.endo_names_long, 'infl');
M_.endo_names = char(M_.endo_names, 'w_h');
M_.endo_names_tex = char(M_.endo_names_tex, 'w\_h');
M_.endo_names_long = char(M_.endo_names_long, 'w_h');
M_.endo_names = char(M_.endo_names, 'w_e');
M_.endo_names_tex = char(M_.endo_names_tex, 'w\_e');
M_.endo_names_long = char(M_.endo_names_long, 'w_e');
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, 'Rd');
M_.endo_names_tex = char(M_.endo_names_tex, 'Rd');
M_.endo_names_long = char(M_.endo_names_long, 'Rd');
M_.endo_names = char(M_.endo_names, 'Ra');
M_.endo_names_tex = char(M_.endo_names_tex, 'Ra');
M_.endo_names_long = char(M_.endo_names_long, 'Ra');
M_.endo_names = char(M_.endo_names, 'lam');
M_.endo_names_tex = char(M_.endo_names_tex, 'lam');
M_.endo_names_long = char(M_.endo_names_long, 'lam');
M_.endo_names = char(M_.endo_names, 'CA');
M_.endo_names_tex = char(M_.endo_names_tex, 'CA');
M_.endo_names_long = char(M_.endo_names_long, 'CA');
M_.endo_names = char(M_.endo_names, 'p');
M_.endo_names_tex = char(M_.endo_names_tex, 'p');
M_.endo_names_long = char(M_.endo_names_long, 'p');
M_.endo_names = char(M_.endo_names, 'TL');
M_.endo_names_tex = char(M_.endo_names_tex, 'TL');
M_.endo_names_long = char(M_.endo_names_long, 'TL');
M_.endo_names = char(M_.endo_names, 'mc');
M_.endo_names_tex = char(M_.endo_names_tex, 'mc');
M_.endo_names_long = char(M_.endo_names_long, 'mc');
M_.endo_names = char(M_.endo_names, 's');
M_.endo_names_tex = char(M_.endo_names_tex, 's');
M_.endo_names_long = char(M_.endo_names_long, 's');
M_.endo_names = char(M_.endo_names, 'mgrowth');
M_.endo_names_tex = char(M_.endo_names_tex, 'mgrowth');
M_.endo_names_long = char(M_.endo_names_long, 'mgrowth');
M_.endo_names = char(M_.endo_names, 'expinfl');
M_.endo_names_tex = char(M_.endo_names_tex, 'expinfl');
M_.endo_names_long = char(M_.endo_names_long, 'expinfl');
M_.endo_names = char(M_.endo_names, 'smalld');
M_.endo_names_tex = char(M_.endo_names_tex, 'smalld');
M_.endo_names_long = char(M_.endo_names_long, 'smalld');
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, 'totC');
M_.endo_names_tex = char(M_.endo_names_tex, 'totC');
M_.endo_names_long = char(M_.endo_names_long, 'totC');
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, 'keff');
M_.endo_names_tex = char(M_.endo_names_tex, 'keff');
M_.endo_names_long = char(M_.endo_names_long, 'keff');
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, 'Kb');
M_.endo_names_tex = char(M_.endo_names_tex, 'Kb');
M_.endo_names_long = char(M_.endo_names_long, 'Kb');
M_.endo_names = char(M_.endo_names, 'Ke');
M_.endo_names_tex = char(M_.endo_names_tex, 'Ke');
M_.endo_names_long = char(M_.endo_names_long, 'Ke');
M_.endo_names = char(M_.endo_names, 'ptilde');
M_.endo_names_tex = char(M_.endo_names_tex, 'ptilde');
M_.endo_names_long = char(M_.endo_names_long, 'ptilde');
M_.endo_names = char(M_.endo_names, 'nump');
M_.endo_names_tex = char(M_.endo_names_tex, 'nump');
M_.endo_names_long = char(M_.endo_names_long, 'nump');
M_.endo_names = char(M_.endo_names, 'denp');
M_.endo_names_tex = char(M_.endo_names_tex, 'denp');
M_.endo_names_long = char(M_.endo_names_long, 'denp');
M_.endo_names = char(M_.endo_names, 'wtilde');
M_.endo_names_tex = char(M_.endo_names_tex, 'wtilde');
M_.endo_names_long = char(M_.endo_names_long, 'wtilde');
M_.endo_names = char(M_.endo_names, 'numw');
M_.endo_names_tex = char(M_.endo_names_tex, 'numw');
M_.endo_names_long = char(M_.endo_names_long, 'numw');
M_.endo_names = char(M_.endo_names, 'denw');
M_.endo_names_tex = char(M_.endo_names_tex, 'denw');
M_.endo_names_long = char(M_.endo_names_long, 'denw');
M_.endo_names = char(M_.endo_names, 'lz');
M_.endo_names_tex = char(M_.endo_names_tex, 'lz');
M_.endo_names_long = char(M_.endo_names_long, 'lz');
M_.endo_names = char(M_.endo_names, 'lmp');
M_.endo_names_tex = char(M_.endo_names_tex, 'lmp');
M_.endo_names_long = char(M_.endo_names_long, 'lmp');
M_.endo_names = char(M_.endo_names, 'lbk');
M_.endo_names_tex = char(M_.endo_names_tex, 'lbk');
M_.endo_names_long = char(M_.endo_names_long, 'lbk');
M_.endo_names = char(M_.endo_names, 'log_y');
M_.endo_names_tex = char(M_.endo_names_tex, 'log\_y');
M_.endo_names_long = char(M_.endo_names_long, 'log_y');
M_.endo_names = char(M_.endo_names, 'log_I');
M_.endo_names_tex = char(M_.endo_names_tex, 'log\_I');
M_.endo_names_long = char(M_.endo_names_long, 'log_I');
M_.param_names = 'habit';
M_.param_names_tex = 'habit';
M_.param_names_long = 'habit';
M_.param_names = char(M_.param_names, 'bet');
M_.param_names_tex = char(M_.param_names_tex, 'bet');
M_.param_names_long = char(M_.param_names_long, 'bet');
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, 'reta');
M_.param_names_tex = char(M_.param_names_tex, 'reta');
M_.param_names_long = char(M_.param_names_long, 'reta');
M_.param_names = char(M_.param_names, 'psi_l');
M_.param_names_tex = char(M_.param_names_tex, 'psi\_l');
M_.param_names_long = char(M_.param_names_long, 'psi_l');
M_.param_names = char(M_.param_names, 'elas_l');
M_.param_names_tex = char(M_.param_names_tex, 'elas\_l');
M_.param_names_long = char(M_.param_names_long, 'elas_l');
M_.param_names = char(M_.param_names, 'chi1');
M_.param_names_tex = char(M_.param_names_tex, 'chi1');
M_.param_names_long = char(M_.param_names_long, 'chi1');
M_.param_names = char(M_.param_names, 'chi2');
M_.param_names_tex = char(M_.param_names_tex, 'chi2');
M_.param_names_long = char(M_.param_names_long, 'chi2');
M_.param_names = char(M_.param_names, 'pi_ss');
M_.param_names_tex = char(M_.param_names_tex, 'pi\_ss');
M_.param_names_long = char(M_.param_names_long, 'pi_ss');
M_.param_names = char(M_.param_names, 'xi_w');
M_.param_names_tex = char(M_.param_names_tex, 'xi\_w');
M_.param_names_long = char(M_.param_names_long, 'xi_w');
M_.param_names = char(M_.param_names, 'phi_w');
M_.param_names_tex = char(M_.param_names_tex, 'phi\_w');
M_.param_names_long = char(M_.param_names_long, 'phi_w');
M_.param_names = char(M_.param_names, 'mark_w');
M_.param_names_tex = char(M_.param_names_tex, 'mark\_w');
M_.param_names_long = char(M_.param_names_long, 'mark_w');
M_.param_names = char(M_.param_names, 'eta_h');
M_.param_names_tex = char(M_.param_names_tex, 'eta\_h');
M_.param_names_long = char(M_.param_names_long, 'eta_h');
M_.param_names = char(M_.param_names, 'eta_e');
M_.param_names_tex = char(M_.param_names_tex, 'eta\_e');
M_.param_names_long = char(M_.param_names_long, 'eta_e');
M_.param_names = char(M_.param_names, 'eta_b');
M_.param_names_tex = char(M_.param_names_tex, 'eta\_b');
M_.param_names_long = char(M_.param_names_long, 'eta_b');
M_.param_names = char(M_.param_names, 'xi_p');
M_.param_names_tex = char(M_.param_names_tex, 'xi\_p');
M_.param_names_long = char(M_.param_names_long, 'xi_p');
M_.param_names = char(M_.param_names, 'phi_p');
M_.param_names_tex = char(M_.param_names_tex, 'phi\_p');
M_.param_names_long = char(M_.param_names_long, 'phi_p');
M_.param_names = char(M_.param_names, 'mark_p');
M_.param_names_tex = char(M_.param_names_tex, 'mark\_p');
M_.param_names_long = char(M_.param_names_long, 'mark_p');
M_.param_names = char(M_.param_names, 'theta_k');
M_.param_names_tex = char(M_.param_names_tex, 'theta\_k');
M_.param_names_long = char(M_.param_names_long, 'theta_k');
M_.param_names = char(M_.param_names, 'theta_h');
M_.param_names_tex = char(M_.param_names_tex, 'theta\_h');
M_.param_names_long = char(M_.param_names_long, 'theta_h');
M_.param_names = char(M_.param_names, 'theta_e');
M_.param_names_tex = char(M_.param_names_tex, 'theta\_e');
M_.param_names_long = char(M_.param_names_long, 'theta_e');
M_.param_names = char(M_.param_names, 'theta_b');
M_.param_names_tex = char(M_.param_names_tex, 'theta\_b');
M_.param_names_long = char(M_.param_names_long, 'theta_b');
M_.param_names = char(M_.param_names, 'alphag');
M_.param_names_tex = char(M_.param_names_tex, 'alphag');
M_.param_names_long = char(M_.param_names_long, 'alphag');
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, 'mu_ss');
M_.param_names_tex = char(M_.param_names_tex, 'mu\_ss');
M_.param_names_long = char(M_.param_names_long, 'mu_ss');
M_.param_names = char(M_.param_names, 'bigR');
M_.param_names_tex = char(M_.param_names_tex, 'bigR');
M_.param_names_long = char(M_.param_names_long, 'bigR');
M_.param_names = char(M_.param_names, 'delalpha');
M_.param_names_tex = char(M_.param_names_tex, 'delalpha');
M_.param_names_long = char(M_.param_names_long, 'delalpha');
M_.param_names = char(M_.param_names, 'smallb');
M_.param_names_tex = char(M_.param_names_tex, 'smallb');
M_.param_names_long = char(M_.param_names_long, 'smallb');
M_.param_names = char(M_.param_names, 'tau_b');
M_.param_names_tex = char(M_.param_names_tex, 'tau\_b');
M_.param_names_long = char(M_.param_names_long, 'tau_b');
M_.param_names = char(M_.param_names, 'tau_e');
M_.param_names_tex = char(M_.param_names_tex, 'tau\_e');
M_.param_names_long = char(M_.param_names_long, 'tau_e');
M_.param_names = char(M_.param_names, 'lam_r');
M_.param_names_tex = char(M_.param_names_tex, 'lam\_r');
M_.param_names_long = char(M_.param_names_long, 'lam_r');
M_.param_names = char(M_.param_names, 'lam_pi');
M_.param_names_tex = char(M_.param_names_tex, 'lam\_pi');
M_.param_names_long = char(M_.param_names_long, 'lam_pi');
M_.param_names = char(M_.param_names, 'lam_y');
M_.param_names_tex = char(M_.param_names_tex, 'lam\_y');
M_.param_names_long = char(M_.param_names_long, 'lam_y');
M_.param_names = char(M_.param_names, 'bigtheta');
M_.param_names_tex = char(M_.param_names_tex, 'bigtheta');
M_.param_names_long = char(M_.param_names_long, 'bigtheta');
M_.param_names = char(M_.param_names, 'bby');
M_.param_names_tex = char(M_.param_names_tex, 'bby');
M_.param_names_long = char(M_.param_names_long, 'bby');
M_.param_names = char(M_.param_names, 'nu');
M_.param_names_tex = char(M_.param_names_tex, 'nu');
M_.param_names_long = char(M_.param_names_long, 'nu');
M_.param_names = char(M_.param_names, 'rhoz');
M_.param_names_tex = char(M_.param_names_tex, 'rhoz');
M_.param_names_long = char(M_.param_names_long, 'rhoz');
M_.param_names = char(M_.param_names, 'rhomp');
M_.param_names_tex = char(M_.param_names_tex, 'rhomp');
M_.param_names_long = char(M_.param_names_long, 'rhomp');
M_.param_names = char(M_.param_names, 'rhobk');
M_.param_names_tex = char(M_.param_names_tex, 'rhobk');
M_.param_names_long = char(M_.param_names_long, 'rhobk');
M_.param_names = char(M_.param_names, 'sigmaz');
M_.param_names_tex = char(M_.param_names_tex, 'sigmaz');
M_.param_names_long = char(M_.param_names_long, 'sigmaz');
M_.param_names = char(M_.param_names, 'sigmamp');
M_.param_names_tex = char(M_.param_names_tex, 'sigmamp');
M_.param_names_long = char(M_.param_names_long, 'sigmamp');
M_.param_names = char(M_.param_names, 'sigmabk');
M_.param_names_tex = char(M_.param_names_tex, 'sigmabk');
M_.param_names_long = char(M_.param_names_long, 'sigmabk');
M_.exo_det_nbr = 0;
M_.exo_nbr = 3;
M_.endo_nbr = 44;
M_.param_nbr = 42;
M_.orig_endo_nbr = 44;
M_.aux_vars = [];
M_.Sigma_e = zeros(3, 3);
M_.Correlation_matrix = eye(3, 3);
M_.H = 0;
M_.Correlation_matrix_ME = 1;
M_.sigma_e_is_diagonal = 1;
options_.block=0;
options_.bytecode=0;
options_.use_dll=0;
erase_compiled_function('BankCapital_static');
erase_compiled_function('BankCapital_dynamic');
M_.lead_lag_incidence = [
 1 13 57;
 0 14 0;
 0 15 0;
 0 16 0;
 2 17 0;
 0 18 0;
 0 19 0;
 0 20 0;
 0 21 0;
 0 22 58;
 0 23 59;
 3 24 60;
 4 25 0;
 0 26 0;
 0 27 0;
 5 28 61;
 0 29 0;
 0 30 62;
 0 31 0;
 6 32 0;
 0 33 0;
 0 34 0;
 0 35 0;
 0 36 0;
 0 37 0;
 0 38 0;
 0 39 0;
 0 40 0;
 0 41 63;
 0 42 0;
 7 43 0;
 8 44 0;
 9 45 0;
 0 46 0;
 0 47 64;
 0 48 65;
 0 49 0;
 0 50 66;
 0 51 67;
 10 52 0;
 11 53 0;
 12 54 0;
 0 55 0;
 0 56 0;]';
M_.nstatic = 24;
M_.nfwrd   = 8;
M_.npred   = 9;
M_.nboth   = 3;
M_.nsfwrd   = 11;
M_.nspred   = 12;
M_.ndynamic   = 20;
M_.equations_tags = {
};
M_.static_and_dynamic_models_differ = 0;
M_.exo_names_orig_ord = [1:3];
M_.maximum_lag = 1;
M_.maximum_lead = 1;
M_.maximum_endo_lag = 1;
M_.maximum_endo_lead = 1;
oo_.steady_state = zeros(44, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(3, 1);
M_.params = NaN(42, 1);
M_.NNZDerivatives = zeros(3, 1);
M_.NNZDerivatives(1) = 171;
M_.NNZDerivatives(2) = -1;
M_.NNZDerivatives(3) = -1;
M_.params( 1 ) = 0.65;
habit = M_.params( 1 );
M_.params( 2 ) = 0.99;
bet = M_.params( 2 );
M_.params( 3 ) = 0.02;
delta = M_.params( 3 );
M_.params( 4 ) = 0.001832219;
reta = M_.params( 4 );
M_.params( 5 ) = 4.55;
psi_l = M_.params( 5 );
M_.params( 6 ) = 0.429;
elas_l = M_.params( 6 );
M_.params( 9 ) = 1.004962931573204;
pi_ss = M_.params( 9 );
M_.params( 31 ) = 0.8;
lam_r = M_.params( 31 );
M_.params( 32 ) = 1.5;
lam_pi = M_.params( 32 );
M_.params( 33 ) = 0.025;
lam_y = M_.params( 33 );
Rd_temp = pi_ss/bet;
M_.params( 10 ) = 21;
xi_w = M_.params( 10 );
M_.params( 11 ) = 0.64;
phi_w = M_.params( 11 );
M_.params( 16 ) = 6;
xi_p = M_.params( 16 );
M_.params( 17 ) = 0.6;
phi_p = M_.params( 17 );
M_.params( 18 ) = M_.params(16)/(M_.params(16)-1);
mark_p = M_.params( 18 );
M_.params( 12 ) = M_.params(10)/(M_.params(10)-1);
mark_w = M_.params( 12 );
M_.params( 13 ) = 0.9;
eta_h = M_.params( 13 );
M_.params( 14 ) = 0.07;
eta_e = M_.params( 14 );
M_.params( 15 ) = 1-M_.params(13)-M_.params(14);
eta_b = M_.params( 15 );
M_.params( 20 ) = 0.639999;
theta_h = M_.params( 20 );
M_.params( 19 ) = 0.36;
theta_k = M_.params( 19 );
M_.params( 21 ) = (1.0-M_.params(20)-M_.params(19))/2.0;
theta_e = M_.params( 21 );
M_.params( 22 ) = 1.0-M_.params(20)-M_.params(19)-M_.params(21);
theta_b = M_.params( 22 );
M_.params( 23 ) = 0.9903;
alphag = M_.params( 23 );
M_.params( 28 ) = 0.1547;
smallb = M_.params( 28 );
M_.params( 27 ) = 0.2411;
delalpha = M_.params( 27 );
M_.params( 29 ) = 0.7230;
tau_b = M_.params( 29 );
M_.params( 30 ) = 0.7817;
tau_e = M_.params( 30 );
M_.params( 26 ) = 1.2118;
bigR = M_.params( 26 );
M_.params( 24 ) = 0.025;
mu = M_.params( 24 );
M_.params( 25 ) = 0.025;
mu_ss = M_.params( 25 );
M_.params( 35 ) = 0.000;
bby = M_.params( 35 );
M_.params( 36 ) = 1.0;
nu = M_.params( 36 );
M_.params( 37 ) = 0.95;
rhoz = M_.params( 37 );
M_.params( 40 ) = 0.0035;
sigmaz = M_.params( 40 );
sigma_a = 0.01;  
M_.params( 38 ) = 0.0;
rhomp = M_.params( 38 );
M_.params( 41 ) = 0.0016;
sigmamp = M_.params( 41 );
M_.params( 39 ) = 0.90;
rhobk = M_.params( 39 );
M_.params( 42 ) = 2.5;
sigmabk = M_.params( 42 );
kk1 = delta*theta_k/(alphag*bigR*(1/bet-1+delta)); 
betatemp  = 1/bet;
infl_temp = pi_ss;
qtemp = kk1*(alphag*tau_b*mu*betatemp/delalpha-(1+mu+alphag*mu/(Rd_temp*delalpha)));
qtemp = qtemp/(alphag*smallb*kk1/(Rd_temp*delalpha)-alphag*bigR*kk1/Rd_temp-theta_e-theta_b-bby-alphag*tau_e*smallb*kk1*betatemp/delalpha);
Gtemp = 1+mu-(qtemp*alphag/Rd_temp)*(bigR-mu/(qtemp*delalpha)-smallb/delalpha);
IY = kk1/qtemp;
KY = alphag*bigR*IY/delta; 
KeY = tau_e*alphag*smallb*IY/delalpha;
KbY = tau_b*alphag*mu*IY/(qtemp*delalpha);
KhY = KY - KeY - KbY;
CeY = (1-tau_e)*alphag*smallb*IY*qtemp/delalpha;
CbY = nu*(1-tau_b)*alphag*mu*IY/delalpha;
ChY = 1 + bby - CeY - CbY  - (1+mu)*IY;
essai = (1-bet*habit)*theta_h/((1-habit)*ChY*psi_l*mark_w);
smallh = essai^(1/(1+elas_l));
Htemp = smallh*eta_h^(xi_w/(xi_w-1));
kk2 = (KY^(1/(1-theta_k))) * (eta_e^(theta_e/(1-theta_k)))* (eta_b^(theta_b/(1-theta_k)))* mark_p^(1/(theta_k-1));
Ktemp = Htemp^(theta_h/(1-theta_k))* kk2;
Ytemp = (1/mark_p)* (Ktemp^theta_k)*(Htemp^theta_h)*(eta_e^theta_e)*(eta_b^theta_b);
M_.params( 34 ) = (M_.params(18)-1)*Ytemp;
bigtheta = M_.params( 34 );
Itemp = IY*Ytemp;
rktemp = (1/mark_p)*theta_k*(Ktemp^(theta_k-1))*(Htemp^theta_h)*(eta_e^theta_e)*(eta_b^theta_b);
M_.params( 7 ) = rktemp;
chi1 = M_.params( 7 );
M_.params( 8 ) = sigma_a*M_.params(7);
chi2 = M_.params( 8 );
w_htemp = (1/mark_p)*theta_h*(Ktemp^theta_k)*(Htemp^(theta_h-1))*(eta_e^theta_e)*(eta_b^theta_b);
w_etemp = (1/mark_p)*theta_e*(Ktemp^theta_k)*(Htemp^theta_h)*(eta_e^(theta_e-1))*(eta_b^theta_b);
w_btemp = (1/mark_p)*theta_b*(Ktemp^theta_k)*(Htemp^theta_h)*(eta_e^theta_e)*(eta_b^(theta_b-1));
Ketemp = KeY*Ytemp;
Kbtemp = KbY*Ytemp;
Khtemp = KhY*Ytemp;
Cetemp = CeY*Ytemp;
Cbtemp = CbY*Ytemp;
chtemp = ChY*Ytemp/eta_h;
bigAtemp = eta_b*w_btemp+(rktemp+qtemp*(1-delta))*Kbtemp+bby*Ytemp;
bigNtemp = eta_e*w_etemp+(rktemp+qtemp*(1-delta))*Ketemp;
totCtemp = Cetemp+Cbtemp+eta_h*chtemp;
lamtemp = (1-bet*habit)/((1-habit)*(chtemp));
smalldtemp = alphag*qtemp*( bigR - smallb/delalpha - mu/(qtemp*delalpha))*Itemp/(Rd_temp*eta_b);
ptemp = (Rd_temp-1)*lamtemp/ ( (Rd_temp-1)*lamtemp*eta_b*smalldtemp + eta_h*reta);
mctemp = reta*ptemp/((Rd_temp-1)*lamtemp);
Ratemp = alphag*qtemp*(mu/(qtemp*delalpha))*Itemp/bigAtemp;
TLtemp = Itemp-bigNtemp;
CAtemp = bigAtemp/((1+mu)*Itemp-bigNtemp);
wtildetemp = w_htemp*infl_temp*eta_h^(-1/(1-xi_w));
numwtemp =  ( ( (w_htemp*infl_temp)^(xi_w*(1+elas_l)) * Htemp^(1+elas_l) )/(1-bet*phi_w) )^(1/(1+elas_l*xi_w));
denwtemp = ( (w_htemp^(xi_w)*infl_temp^(xi_w-1)*Htemp*lamtemp)/(1-bet*phi_w) )^(1/(1+elas_l*xi_w));
wtildetemp = (mark_w*psi_l)^(1/(1+xi_w*elas_l))*numwtemp/denwtemp;
stemp = 1/mark_p;
mgrowthtemp = infl_temp;
expinfltemp = infl_temp;
gYtemp = 1;
utemp = 1;
resid;
steady;
oo_.dr.eigval = check(M_,options_,oo_);
%
% SHOCKS instructions
%
make_ex_;
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = M_.params(40)^2;
M_.Sigma_e(2, 2) = M_.params(41)^2;
M_.Sigma_e(3, 3) = M_.params(42)^2;
options_.hp_filter = 1600;
options_.irf = 100;
options_.nograph = 1;
options_.order = 1;
var_list_=[];
info = stoch_simul(var_list_);
save('BankCapital_results.mat', 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save('BankCapital_results.mat', 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save('BankCapital_results.mat', 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save('BankCapital_results.mat', 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save('BankCapital_results.mat', 'estimation_info', '-append');
end


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