% Se carga el modelo benchmark con el valor de los parámetros y desviaciones estándar estimados
load('Modelo_benchmark.mod');


% Tamaño de la muestra
T = 66;


% Valores iniciales para todas las variables del modelo
y0 = [oo_.SmoothedVariables.p_OIL(1) + oo_.steady_state(1);
oo_.SmoothedVariables.y_OIL(1) + oo_.steady_state(2);
oo_.SmoothedVariables.R_ast(1) + oo_.steady_state(3);
oo_.SmoothedVariables.R_f(1) + oo_.steady_state(4);
oo_.SmoothedVariables.b_ast(1) + oo_.steady_state(5);
oo_.SmoothedVariables.lambda_1(1) + oo_.steady_state(6);
oo_.SmoothedVariables.c(1) + oo_.steady_state(7);
oo_.SmoothedVariables.h(1) + oo_.steady_state(8);
oo_.SmoothedVariables.w(1) + oo_.steady_state(9);
oo_.SmoothedVariables.R(1) + oo_.steady_state(10);
oo_.SmoothedVariables.q(1) + oo_.steady_state(11);
oo_.SmoothedVariables.c_T(1) + oo_.steady_state(12);
oo_.SmoothedVariables.p_T(1) + oo_.steady_state(13);
oo_.SmoothedVariables.c_NT(1) + oo_.steady_state(14);
oo_.SmoothedVariables.p_NT(1) + oo_.steady_state(15);
oo_.SmoothedVariables.y_T(1) + oo_.steady_state(16);
oo_.SmoothedVariables.z_T(1) + oo_.steady_state(17);
oo_.SmoothedVariables.h_T(1) + oo_.steady_state(18);
oo_.SmoothedVariables.z_NT(1) + oo_.steady_state(19);
oo_.SmoothedVariables.fi_NT(1) + oo_.steady_state(20);
oo_.SmoothedVariables.h_NT(1) + oo_.steady_state(21);
oo_.SmoothedVariables.y_NT(1) + oo_.steady_state(22);
oo_.SmoothedVariables.OIL_IN(1) + oo_.steady_state(23);
oo_.SmoothedVariables.PSI(1) + oo_.steady_state(24);
oo_.SmoothedVariables.PI_NT(1) + oo_.steady_state(25);
oo_.SmoothedVariables.ZETA(1) + oo_.steady_state(26);
oo_.SmoothedVariables.p_NT_hat(1) + oo_.steady_state(27);
oo_.SmoothedVariables.I(1) + oo_.steady_state(28);
oo_.SmoothedVariables.PI(1) + oo_.steady_state(29);
oo_.SmoothedVariables.z_I(1) + oo_.steady_state(30);
oo_.SmoothedVariables.y(1) + oo_.steady_state(31);
oo_.SmoothedVariables.p_T_ast(1) + oo_.steady_state(32);
oo_.SmoothedVariables.PI_T(1) + oo_.steady_state(33);
oo_.SmoothedVariables.OIL_OUT(1) + oo_.steady_state(34);
oo_.SmoothedVariables.Dev_nom(1) + oo_.steady_state(35);
oo_.SmoothedVariables.PI_ast(1) + oo_.steady_state(36);
oo_.SmoothedVariables.p_OIL_OBS(1) + oo_.steady_state(37);
oo_.SmoothedVariables.y_OBS(1) + oo_.steady_state(38);
oo_.SmoothedVariables.PI_OBS(1) + oo_.steady_state(39);
oo_.SmoothedVariables.I_OBS(1) + oo_.steady_state(40);
oo_.SmoothedVariables.Dev_nom_OBS(1) + oo_.steady_state(41)];


% Choques estructurales
ex_ = [oo_.SmoothedShocks.e_p_OIL(2:T),...
oo_.SmoothedShocks.e_y_OIL(2:T),...
oo_.SmoothedShocks.e_R_f(2:T),...
oo_.SmoothedShocks.e_z_T(2:T),...
oo_.SmoothedShocks.e_z_NT(2:T),...
oo_.SmoothedShocks.e_z_I(2:T),...
oo_.SmoothedShocks.e_p_T_ast(2:T),...
oo_.SmoothedShocks.e_PI_ast(2:T)];


% Se carga el modelo alternativo con el valor de los parámetros y desviaciones estándar estimados
load('Modelo_benchmark.mod');
%load('Modelo_alternativo.mod');


% Solución del modelo alternativo
dr = oo_Modelo_benchmark.dr;
%dr = oo_Modelo_alternativo.dr;

% Orden de aproximación
iorder = 1;

% Simulación del modelo alternativo con los valores iniciales de las variables y los choques estructurales del modelo benchmark
y_simul = simult_(y0,dr,ex_,iorder);