%
% 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 = 'norges_bgg';
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('norges_bgg.log');
M_.exo_names = 'xi_y';
M_.exo_names_tex = 'xi\_y';
M_.exo_names_long = 'xi_y';
M_.exo_names = char(M_.exo_names, 'xi_C_f');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_C\_f');
M_.exo_names_long = char(M_.exo_names_long, 'xi_C_f');
M_.exo_names = char(M_.exo_names, 'xi_r');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_r');
M_.exo_names_long = char(M_.exo_names_long, 'xi_r');
M_.exo_names = char(M_.exo_names, 'xi_rf');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_rf');
M_.exo_names_long = char(M_.exo_names_long, 'xi_rf');
M_.exo_names = char(M_.exo_names, 'xi_b');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_b');
M_.exo_names_long = char(M_.exo_names_long, 'xi_b');
M_.exo_names = char(M_.exo_names, 'xi_pif_f');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_pif\_f');
M_.exo_names_long = char(M_.exo_names_long, 'xi_pif_f');
M_.exo_names = char(M_.exo_names, 'xi_G');
M_.exo_names_tex = char(M_.exo_names_tex, 'xi\_G');
M_.exo_names_long = char(M_.exo_names_long, 'xi_G');
M_.exo_names = char(M_.exo_names, 'u_x');
M_.exo_names_tex = char(M_.exo_names_tex, 'u\_x');
M_.exo_names_long = char(M_.exo_names_long, 'u_x');
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, 'CH');
M_.endo_names_tex = char(M_.endo_names_tex, 'CH');
M_.endo_names_long = char(M_.endo_names_long, 'CH');
M_.endo_names = char(M_.endo_names, 'CF');
M_.endo_names_tex = char(M_.endo_names_tex, 'CF');
M_.endo_names_long = char(M_.endo_names_long, 'CF');
M_.endo_names = char(M_.endo_names, 'CH_f');
M_.endo_names_tex = char(M_.endo_names_tex, 'CH\_f');
M_.endo_names_long = char(M_.endo_names_long, 'CH_f');
M_.endo_names = char(M_.endo_names, 'C_f');
M_.endo_names_tex = char(M_.endo_names_tex, 'C\_f');
M_.endo_names_long = char(M_.endo_names_long, 'C_f');
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, 'rf');
M_.endo_names_tex = char(M_.endo_names_tex, 'rf');
M_.endo_names_long = char(M_.endo_names_long, 'rf');
M_.endo_names = char(M_.endo_names, 'bf');
M_.endo_names_tex = char(M_.endo_names_tex, 'bf');
M_.endo_names_long = char(M_.endo_names_long, 'bf');
M_.endo_names = char(M_.endo_names, 'z_y');
M_.endo_names_tex = char(M_.endo_names_tex, 'z\_y');
M_.endo_names_long = char(M_.endo_names_long, 'z_y');
M_.endo_names = char(M_.endo_names, 'z_r');
M_.endo_names_tex = char(M_.endo_names_tex, 'z\_r');
M_.endo_names_long = char(M_.endo_names_long, 'z_r');
M_.endo_names = char(M_.endo_names, 'z_b');
M_.endo_names_tex = char(M_.endo_names_tex, 'z\_b');
M_.endo_names_long = char(M_.endo_names_long, 'z_b');
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, 'pih');
M_.endo_names_tex = char(M_.endo_names_tex, 'pih');
M_.endo_names_long = char(M_.endo_names_long, 'pih');
M_.endo_names = char(M_.endo_names, 'pif');
M_.endo_names_tex = char(M_.endo_names_tex, 'pif');
M_.endo_names_long = char(M_.endo_names_long, 'pif');
M_.endo_names = char(M_.endo_names, 'pif_f');
M_.endo_names_tex = char(M_.endo_names_tex, 'pif\_f');
M_.endo_names_long = char(M_.endo_names_long, 'pif_f');
M_.endo_names = char(M_.endo_names, 'ph');
M_.endo_names_tex = char(M_.endo_names_tex, 'ph');
M_.endo_names_long = char(M_.endo_names_long, 'ph');
M_.endo_names = char(M_.endo_names, 'pf');
M_.endo_names_tex = char(M_.endo_names_tex, 'pf');
M_.endo_names_long = char(M_.endo_names_long, 'pf');
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, '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, 'N');
M_.endo_names_tex = char(M_.endo_names_tex, 'N');
M_.endo_names_long = char(M_.endo_names_long, 'N');
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, '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, 'z');
M_.endo_names_tex = char(M_.endo_names_tex, 'z');
M_.endo_names_long = char(M_.endo_names_long, 'z');
M_.endo_names = char(M_.endo_names, 'cost');
M_.endo_names_tex = char(M_.endo_names_tex, 'cost');
M_.endo_names_long = char(M_.endo_names_long, 'cost');
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, '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, 'f');
M_.endo_names_tex = char(M_.endo_names_tex, 'f');
M_.endo_names_long = char(M_.endo_names_long, 'f');
M_.endo_names = char(M_.endo_names, 'x');
M_.endo_names_tex = char(M_.endo_names_tex, 'x');
M_.endo_names_long = char(M_.endo_names_long, 'x');
M_.endo_names = char(M_.endo_names, 'rp');
M_.endo_names_tex = char(M_.endo_names_tex, 'rp');
M_.endo_names_long = char(M_.endo_names_long, 'rp');
M_.endo_names = char(M_.endo_names, 'n');
M_.endo_names_tex = char(M_.endo_names_tex, 'n');
M_.endo_names_long = char(M_.endo_names_long, 'n');
M_.endo_names = char(M_.endo_names, 'nx');
M_.endo_names_tex = char(M_.endo_names_tex, 'nx');
M_.endo_names_long = char(M_.endo_names_long, 'nx');
M_.endo_partitions = struct();
M_.param_names = 'alpha';
M_.param_names_tex = 'alpha';
M_.param_names_long = 'alpha';
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, 'eta');
M_.param_names_tex = char(M_.param_names_tex, 'eta');
M_.param_names_long = char(M_.param_names_long, 'eta');
M_.param_names = char(M_.param_names, 'h');
M_.param_names_tex = char(M_.param_names_tex, 'h');
M_.param_names_long = char(M_.param_names_long, 'h');
M_.param_names = char(M_.param_names, 'gammac');
M_.param_names_tex = char(M_.param_names_tex, 'gammac');
M_.param_names_long = char(M_.param_names_long, 'gammac');
M_.param_names = char(M_.param_names, 'gammay');
M_.param_names_tex = char(M_.param_names_tex, 'gammay');
M_.param_names_long = char(M_.param_names_long, 'gammay');
M_.param_names = char(M_.param_names, 'omega_pi');
M_.param_names_tex = char(M_.param_names_tex, 'omega\_pi');
M_.param_names_long = char(M_.param_names_long, 'omega_pi');
M_.param_names = char(M_.param_names, 'omega_y');
M_.param_names_tex = char(M_.param_names_tex, 'omega\_y');
M_.param_names_long = char(M_.param_names_long, 'omega_y');
M_.param_names = char(M_.param_names, 'omega_r');
M_.param_names_tex = char(M_.param_names_tex, 'omega\_r');
M_.param_names_long = char(M_.param_names_long, 'omega_r');
M_.param_names = char(M_.param_names, 'phi');
M_.param_names_tex = char(M_.param_names_tex, 'phi');
M_.param_names_long = char(M_.param_names_long, 'phi');
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, 'vphi');
M_.param_names_tex = char(M_.param_names_tex, 'vphi');
M_.param_names_long = char(M_.param_names_long, 'vphi');
M_.param_names = char(M_.param_names, 'rho_r');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_r');
M_.param_names_long = char(M_.param_names_long, 'rho_r');
M_.param_names = char(M_.param_names, 'rho_rf');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_rf');
M_.param_names_long = char(M_.param_names_long, 'rho_rf');
M_.param_names = char(M_.param_names, 'rho_y');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_y');
M_.param_names_long = char(M_.param_names_long, 'rho_y');
M_.param_names = char(M_.param_names, 'rho_b');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_b');
M_.param_names_long = char(M_.param_names_long, 'rho_b');
M_.param_names = char(M_.param_names, 'rho_C_f');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_C\_f');
M_.param_names_long = char(M_.param_names_long, 'rho_C_f');
M_.param_names = char(M_.param_names, 'rho_pif_f');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_pif\_f');
M_.param_names_long = char(M_.param_names_long, 'rho_pif_f');
M_.param_names = char(M_.param_names, 'rho_G');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_G');
M_.param_names_long = char(M_.param_names_long, 'rho_G');
M_.param_names = char(M_.param_names, 'GSS');
M_.param_names_tex = char(M_.param_names_tex, 'GSS');
M_.param_names_long = char(M_.param_names_long, 'GSS');
M_.param_names = char(M_.param_names, 'QSS');
M_.param_names_tex = char(M_.param_names_tex, 'QSS');
M_.param_names_long = char(M_.param_names_long, 'QSS');
M_.param_names = char(M_.param_names, 'phSS');
M_.param_names_tex = char(M_.param_names_tex, 'phSS');
M_.param_names_long = char(M_.param_names_long, 'phSS');
M_.param_names = char(M_.param_names, 'pfSS');
M_.param_names_tex = char(M_.param_names_tex, 'pfSS');
M_.param_names_long = char(M_.param_names_long, 'pfSS');
M_.param_names = char(M_.param_names, 'CHSS');
M_.param_names_tex = char(M_.param_names_tex, 'CHSS');
M_.param_names_long = char(M_.param_names_long, 'CHSS');
M_.param_names = char(M_.param_names, 'CFSS');
M_.param_names_tex = char(M_.param_names_tex, 'CFSS');
M_.param_names_long = char(M_.param_names_long, 'CFSS');
M_.param_names = char(M_.param_names, 'CH_fSS');
M_.param_names_tex = char(M_.param_names_tex, 'CH\_fSS');
M_.param_names_long = char(M_.param_names_long, 'CH_fSS');
M_.param_names = char(M_.param_names, 'pi_fSS');
M_.param_names_tex = char(M_.param_names_tex, 'pi\_fSS');
M_.param_names_long = char(M_.param_names_long, 'pi_fSS');
M_.param_names = char(M_.param_names, 'rSS');
M_.param_names_tex = char(M_.param_names_tex, 'rSS');
M_.param_names_long = char(M_.param_names_long, 'rSS');
M_.param_names = char(M_.param_names, 'ySS');
M_.param_names_tex = char(M_.param_names_tex, 'ySS');
M_.param_names_long = char(M_.param_names_long, 'ySS');
M_.param_names = char(M_.param_names, 'ISS');
M_.param_names_tex = char(M_.param_names_tex, 'ISS');
M_.param_names_long = char(M_.param_names_long, 'ISS');
M_.param_names = char(M_.param_names, 'S');
M_.param_names_tex = char(M_.param_names_tex, 'S');
M_.param_names_long = char(M_.param_names_long, 'S');
M_.param_names = char(M_.param_names, 'z_ss');
M_.param_names_tex = char(M_.param_names_tex, 'z\_ss');
M_.param_names_long = char(M_.param_names_long, 'z_ss');
M_.param_names = char(M_.param_names, 'f_ss');
M_.param_names_tex = char(M_.param_names_tex, 'f\_ss');
M_.param_names_long = char(M_.param_names_long, 'f_ss');
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, 'chi');
M_.param_names_tex = char(M_.param_names_tex, 'chi');
M_.param_names_long = char(M_.param_names_long, 'chi');
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, '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, 'k_n');
M_.param_names_tex = char(M_.param_names_tex, 'k\_n');
M_.param_names_long = char(M_.param_names_long, 'k_n');
M_.param_names = char(M_.param_names, 'indexh');
M_.param_names_tex = char(M_.param_names_tex, 'indexh');
M_.param_names_long = char(M_.param_names_long, 'indexh');
M_.param_names = char(M_.param_names, 'indexf');
M_.param_names_tex = char(M_.param_names_tex, 'indexf');
M_.param_names_long = char(M_.param_names_long, 'indexf');
M_.param_names = char(M_.param_names, 'fih');
M_.param_names_tex = char(M_.param_names_tex, 'fih');
M_.param_names_long = char(M_.param_names_long, 'fih');
M_.param_names = char(M_.param_names, 'fif');
M_.param_names_tex = char(M_.param_names_tex, 'fif');
M_.param_names_long = char(M_.param_names_long, 'fif');
M_.param_names = char(M_.param_names, 'CHTSS');
M_.param_names_tex = char(M_.param_names_tex, 'CHTSS');
M_.param_names_long = char(M_.param_names_long, 'CHTSS');
M_.param_names = char(M_.param_names, 'rho_x');
M_.param_names_tex = char(M_.param_names_tex, 'rho\_x');
M_.param_names_long = char(M_.param_names_long, 'rho_x');
M_.param_partitions = struct();
M_.exo_det_nbr = 0;
M_.exo_nbr = 8;
M_.endo_nbr = 32;
M_.param_nbr = 44;
M_.orig_endo_nbr = 32;
M_.aux_vars = [];
options_.varobs = cell(1);
options_.varobs(1)  = {'y'};
options_.varobs(2)  = {'C'};
options_.varobs(3)  = {'inv'};
options_.varobs(4)  = {'Q'};
options_.varobs(5)  = {'r'};
options_.varobs(6)  = {'pi'};
options_.varobs_id = [ 1 2 23 20 7 13  ];
M_.Sigma_e = zeros(8, 8);
M_.Correlation_matrix = eye(8, 8);
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('norges_bgg_static');
erase_compiled_function('norges_bgg_dynamic');
M_.orig_eq_nbr = 32;
M_.eq_nbr = 32;
M_.ramsey_eq_nbr = 0;
M_.set_auxiliary_variables = exist(['./' M_.fname '_set_auxiliary_variables.m'], 'file') == 2;
M_.lead_lag_incidence = [
 1 20 0;
 2 21 52;
 0 22 0;
 0 23 0;
 0 24 0;
 3 25 0;
 4 26 0;
 5 27 0;
 6 28 0;
 7 29 0;
 8 30 0;
 9 31 0;
 0 32 53;
 10 33 54;
 11 34 55;
 12 35 56;
 13 36 0;
 14 37 0;
 0 38 0;
 0 39 57;
 0 40 0;
 15 41 0;
 0 42 0;
 0 43 0;
 0 44 0;
 16 45 0;
 17 46 0;
 0 47 58;
 18 48 0;
 0 49 0;
 19 50 0;
 0 51 0;]';
M_.nstatic = 10;
M_.nfwrd   = 3;
M_.npred   = 15;
M_.nboth   = 4;
M_.nsfwrd   = 7;
M_.nspred   = 19;
M_.ndynamic   = 22;
M_.equations_tags = {
};
M_.static_and_dynamic_models_differ = 0;
M_.exo_names_orig_ord = [1:8];
M_.maximum_lag = 1;
M_.maximum_lead = 1;
M_.maximum_endo_lag = 1;
M_.maximum_endo_lead = 1;
oo_.steady_state = zeros(32, 1);
M_.maximum_exo_lag = 0;
M_.maximum_exo_lead = 0;
oo_.exo_steady_state = zeros(8, 1);
M_.params = NaN(44, 1);
M_.NNZDerivatives = [135; 0; -1];
M_.params( 1 ) = 0.3;
alpha = M_.params( 1 );
M_.params( 2 ) = 0.985;
beta = M_.params( 2 );
M_.params( 11 ) = 1;
sigma = M_.params( 11 );
M_.params( 12 ) = 1;
vphi = M_.params( 12 );
M_.params( 3 ) = 1.1;
eta = M_.params( 3 );
M_.params( 7 ) = 1.5;
omega_pi = M_.params( 7 );
M_.params( 8 ) = 0.5;
omega_y = M_.params( 8 );
M_.params( 9 ) = 0.7;
omega_r = M_.params( 9 );
M_.params( 10 ) = 0.0002;
phi = M_.params( 10 );
M_.params( 4 ) = 0.75;
h = M_.params( 4 );
M_.params( 15 ) = 0.5;
rho_y = M_.params( 15 );
M_.params( 16 ) = 0.5;
rho_b = M_.params( 16 );
M_.params( 19 ) = 0.5;
rho_G = M_.params( 19 );
M_.params( 13 ) = 0.5;
rho_r = M_.params( 13 );
M_.params( 14 ) = 0.5;
rho_rf = M_.params( 14 );
M_.params( 18 ) = 0.97;
rho_pif_f = M_.params( 18 );
M_.params( 17 ) = 0.5;
rho_C_f = M_.params( 17 );
M_.params( 44 ) = 0.5;
rho_x = M_.params( 44 );
M_.params( 5 ) = 0.17;
gammac = M_.params( 5 );
M_.params( 6 ) = 0.17;
gammay = M_.params( 6 );
M_.params( 23 ) = 0.86452;
pfSS = M_.params( 23 );
M_.params( 24 ) = 0.62;
CHSS = M_.params( 24 );
M_.params( 20 ) = 0.2;
GSS = M_.params( 20 );
M_.params( 27 ) = 1;
pi_fSS = M_.params( 27 );
M_.params( 28 ) = 1/M_.params(2);
rSS = M_.params( 28 );
M_.params( 29 ) = 1.12;
ySS = M_.params( 29 );
M_.params( 43 ) = 1.12;
CHTSS = M_.params( 43 );
M_.params( 22 ) = 1;
phSS = M_.params( 22 );
M_.params( 26 ) = 0.13;
CH_fSS = M_.params( 26 );
M_.params( 25 ) = 0.12;
CFSS = M_.params( 25 );
M_.params( 21 ) = M_.params(26)*M_.params(22)/M_.params(25);
QSS = M_.params( 21 );
M_.params( 39 ) = 0.5;
indexh = M_.params( 39 );
M_.params( 40 ) = 0.5;
indexf = M_.params( 40 );
M_.params( 41 ) = 0.75;
fih = M_.params( 41 );
M_.params( 42 ) = 0.75;
fif = M_.params( 42 );
M_.params( 30 ) = 0.17;
ISS = M_.params( 30 );
M_.params( 31 ) = 1.0080;
S = M_.params( 31 );
M_.params( 33 ) = M_.params(31)*M_.params(28);
f_ss = M_.params( 33 );
M_.params( 34 ) = 0.025;
delta = M_.params( 34 );
M_.params( 32 ) = M_.params(33)+M_.params(34)-1;
z_ss = M_.params( 32 );
M_.params( 35 ) = 0.5882;
chi = M_.params( 35 );
M_.params( 36 ) = 0.042;
psi = M_.params( 36 );
M_.params( 37 ) = 0.9762;
nu = M_.params( 37 );
M_.params( 38 ) = 1.2;
k_n = M_.params( 38 );
%
% SHOCKS instructions
%
M_.exo_det_length = 0;
M_.Sigma_e(1, 1) = (0.5)^2;
M_.Sigma_e(2, 2) = (45)^2;
M_.Sigma_e(3, 3) = (2.5)^2;
M_.Sigma_e(4, 4) = (20)^2;
M_.Sigma_e(5, 5) = (8)^2;
M_.Sigma_e(6, 6) = (0.25)^2;
M_.Sigma_e(7, 7) = (30)^2;
M_.Sigma_e(8, 8) = (7.5)^2;
steady;
oo_.dr.eigval = check(M_,options_,oo_);
options_.irf = 0;
var_list_ = char('y','inv','C','pi','rp','n','q','Q','nx');
info = stoch_simul(var_list_);
estim_params_.var_exo = zeros(0, 10);
estim_params_.var_endo = zeros(0, 10);
estim_params_.corrx = zeros(0, 11);
estim_params_.corrn = zeros(0, 11);
estim_params_.param_vals = zeros(0, 10);
estim_params_.param_vals = [estim_params_.param_vals; 19, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 15, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 16, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 13, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 17, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 14, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 44, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 18, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 7, NaN, (-Inf), Inf, 4, 30, 15, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 6, NaN, (-Inf), Inf, 4, 0.53, 0.25, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 1, NaN, (-Inf), Inf, 4, 1.5, 0.5, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 5, NaN, (-Inf), Inf, 4, 16, 8, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 3, NaN, (-Inf), Inf, 4, 5, 2.5, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 2, NaN, (-Inf), Inf, 4, 90, 45, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 4, NaN, (-Inf), Inf, 4, 40, 20, NaN, NaN, NaN ];
estim_params_.var_exo = [estim_params_.var_exo; 8, NaN, (-Inf), Inf, 4, 15, 7.5, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 4, NaN, (-Inf), Inf, 1, 0.5, 0.2, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 9, NaN, (-Inf), Inf, 1, 0.75, 0.15, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 7, NaN, (-Inf), Inf, 2, 2, 0.15, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 8, NaN, (-Inf), Inf, 2, 0.50, 0.15, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 10, NaN, (-Inf), Inf, 2, 0.001, 0.0005, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 41, NaN, (-Inf), Inf, 1, 0.75, 0.1, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 39, NaN, (-Inf), Inf, 1, 0.5, 0.25, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 42, NaN, (-Inf), Inf, 1, 0.75, 0.1, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 40, NaN, (-Inf), Inf, 1, 0.5, 0.25, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 35, NaN, (-Inf), Inf, 2, 0.5, 0.25, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 36, NaN, (-Inf), Inf, 2, 0.10, 0.05, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 11, NaN, (-Inf), Inf, 2, 1, 0.5, NaN, NaN, NaN ];
estim_params_.param_vals = [estim_params_.param_vals; 12, NaN, (-Inf), Inf, 2, 2, 1, NaN, NaN, NaN ];
options_.bayesian_irf = 1;
options_.filtered_vars = 1;
options_.mh_drop = 0.3;
options_.mh_jscale = 0.4;
options_.mh_nblck = 2;
options_.mh_replic = 5000;
options_.mode_check.status = 1;
options_.mode_compute = 6;
options_.moments_varendo = 1;
options_.prefilter = 1;
options_.smoother = 1;
options_.datafile = 'norges_data2';
options_.order = 1;
var_list_ = char('y','inv','C','pi','rp','Q','nx','r');
oo_recursive_=dynare_estimation(var_list_);
options_.irf = 40;
options_.nograph = 1;
options_.conditional_variance_decomposition = [1;4;8;16;32;];
var_list_ = char('y','inv','C','pi','rp','Q','nx','r');
info = stoch_simul(var_list_);
options_ident = struct();
options_ident.parameter_set = 'posterior_mean';
dynare_identification(options_ident);
var_list_ = char('y','inv','C','pi','rp','Q','nx','r');
[oo_,M_]= shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);
dyngraph;
save('norges_bgg_results.mat', 'oo_', 'M_', 'options_');
if exist('estim_params_', 'var') == 1
  save('norges_bgg_results.mat', 'estim_params_', '-append');
end
if exist('bayestopt_', 'var') == 1
  save('norges_bgg_results.mat', 'bayestopt_', '-append');
end
if exist('dataset_', 'var') == 1
  save('norges_bgg_results.mat', 'dataset_', '-append');
end
if exist('estimation_info', 'var') == 1
  save('norges_bgg_results.mat', 'estimation_info', '-append');
end
if exist('dataset_info', 'var') == 1
  save('norges_bgg_results.mat', 'dataset_info', '-append');
end
if exist('oo_recursive_', 'var') == 1
  save('norges_bgg_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
