clear all
addpath('C:\dynare\4.6.1\matlab') 

%1. Computar dinamica de solucion del modelo con Dynare, mi modelo se llama neoclassical_covid19.mod.
dynare examen_model1.mod
close all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
varble = {'e','y','pic','inv','qr','n','bG','lab'};
names  ={'Enfermos','PIB', 'Inflacion','Inversion','Q Tobin','Net Worth','Deuda','Empleo'};
[nper,junk1] = size(y_e_en);
nvar = length(varble);
dates = (0:1:nper)';

%Shock enfermos: 
shock='e_en';
size_shock=1;
resp_mat1=[];
for ii=1:nvar
  eva1(['y1=',char(varble(ii)),'_',char(shock),';']);
  y1=y1*size_shock;
  y1=[0;y1];
  resp_mat1=[resp_mat1 y1];
end

save('irf_base','resp_mat1');

%Shock cuarentena:
shock='e_muc';
size_shock=1;
resp_mat2=[];
for ii=1:nvar
  eva1(['y2=',char(varble(ii)),'_',char(shock),';']);
  y2=y2*size_shock;
  y2=[0;y2];
  resp_mat2=[resp_mat2 y2];
end

%Shock riesgo:
shock='e_nu';
size_shock=1;
resp_mat3=[];
for ii=1:nvar
  eva1(['y3=',char(varble(ii)),'_',char(shock),';']);
  y3=y3*size_shock;
  y3=[0;y3];
  resp_mat3=[resp_mat3 y3];
end

%Combinado
figure(1)
for ii=1:nvar
  subplot(4,2,ii);
  plot(dates,resp_mat1(:,ii)+resp_mat2(:,ii)+resp_mat3(:,ii),'-b','LineWidth',2);
  xlabel('Semanas','Fontsize',14);
  ylabel('Desv. c/r/a EE','Fontsize',14);
  title(names(ii),'Interpreter','none','Fontsize',14);
  if ii==1
    legend('Shock enfermos + cuarentena + riesgo');
  end
end
