##################
# README - model code of
# Macroepidemics and unconventional monetary policy:  Coupling macroeconomics and epidemiology in a financial DSGE-SIRframework
# by Acurio-Vásconez, V., O. Damette, and D. W. Shanafelt  using dynare 4.6.x
##################


Link to paper: https://cepr.org/sites/default/files/CovidEconomics67.pdf#Paper7
Link to code: https://osf.io/j7m65/



The main folder contains:
ADS_SIR - contains the files creating inital and end values of the infection path as well as all model equations (ADS_func.m fetches them and write them in a .mod-file)
dynare - contains the dynare files (and output) which are created and executed by the main file (ADS_simulation.m)
epi_models - contains the files generating the SIR dynamics (approximated differential equations and its solution)
Graphs - contains the numerical and graphical IRFs (for different parameter settings), as well as the files creating the plots
Params_setting - contains the initial parameter settings and the resulting initial steady state values
Settings - contains the inital and end values of the infection path, as well as the dynamics in between (for different models)
ADS_func.m - assigns variables to be endogenous or exogenous, loads path of infected as exogenous shock, and writes the mod-file
ADS_main.m - specifies, which model is solved (SIR, SIRS, ...) and executes ADS_func.m
ADS_simulation.m - main execution file, fetches the initializations and executes ADS_main, running it computes the baseline results of the paper 



1 Open the file ADS_simulation.m, select the country “US” (=default) and run the file
2 Replicate figure 3 and figure 4 of the paper by going to the folder “Graphs” and use PlotTraj_figure.m
3 Open the file PlotTraj_figure.m in the “Results” folder and change the name of the loaded file to the name of your numeric results file.  

4 In order to replicate figure 6, you need to change the values of the parameter representing the leverage ratio (in line 26 of the main file ADS_simulation.m). Run ADS_imulation.m.
5 In order to get a plot with all three IRFs (φ= 2,4,6) open and run PlotTraj_phi.m.
6 Figure 7 can be replicated like figure 6. A graphical representation similar to the working paper can be created by PlotTraj_omega.m.
7 In order to replicate figure 8, some adaptions to ADS_func.m are necessary. Remove ̄psi-bar as parameter and include it as an exogenous shock.
In line 67 and 104 we do not want to call all parameters anymore. To remove ̄psi-bar, replace nnparams with nnparams-1. In order to introduce ̄psie-bar as exogenous variable, replace line 96 with [’varexo ’ varexostring ’ psibar;\n\n’]. 
Finally, we have to add a second exogenous shock to the shock part of the dynare code. Plug in fprintf(fid, ’var psibar;\n’);fprintf(fid, ’periods 1:20;\n’); andfprintf(fid,’values 0.5;\n’) between the lines 249 and 250.
8 Run ADS_simulation.m to derive and save the numeric IRFs.  Figure 8 can be replicated by the file PlotTraj_psi.m.






