## tnmea2021007 — DIGNAR-19 toolkit user guide excerpt (references and procedures)

## Source details

**Canonical URL:** [tnmea2021007 — DIGNAR-19 toolkit user guide excerpt (references and procedures)](https://www.imf.org/-/media/files/publications/tnm/2021/english/tnmea2021007.pdf)

## Other formats

- [Markdown version](/-/media/files/publications/tnm/2021/english/tnmea2021007.pdf.md)
- [Structured JSON version](/-/media/files/publications/tnm/2021/english/tnmea2021007.pdf.json)

---

### Toolkit purpose and scope
- DIGNAR-19 is a Dynamic General Equilibrium (DGE) model of a real small open economy developed at the International Monetary Fund to help country teams with quantitative macroeconomic assessments and policy scenario analysis in Low-Income Developing Countries (LIDCs) and Emerging Markets (EMs) during the COVID-19 pandemic.
- DIGNAR-19 extends the DIGNAR model (itself an extension of the DIG model by Buffie and others, 2012; Zanna and others, 2019) to accommodate the effects of the COVID-19 pandemic.
- DIGNAR-19 acronym: Debt, Investment, Growth, NAtural Resources and COVID-19.
- Primary focus: incorporate pandemic-associated shocks and produce macroeconomic projections emphasizing GDP growth and government debt within an internally consistent general equilibrium framework.
- Historical use: DIG and DIGNAR models complemented IMF and World Bank Debt Sustainability Framework (DSF) analysis, with over 65 country applications.

### Toolkit components and technical requirements
- Interface: Excel-based front end that translates inputs into instructions for Matlab/Dynare programs executed behind the scenes.
- Required software: Excel, Matlab, and Dynare.
- Designed to operate on Matlab version 2019b and Dynare version 4.5.6.
- Excel interface consists of two files:
  - Input file: ‘input.xlsx’ with five worksheets: ‘Calibration’, ‘Exogenous series’, ‘Scenarios’, ‘Customized graphs’, and ‘External baseline’.
  - Output file: ‘outputs.xls’; each worksheet contains macroeconomic projections based on a single scenario.

### Calibration worksheet (user inputs and cell conventions)
- Purpose: tune DIGNAR-19 to a specific country application.
- Five calibration groups:
  - National accounting
  - Interest rates
  - Structural parameters
  - Natural resource sector
  - Fiscal policy
- Cell types and guidance:
  - Green cells: contain highly country-specific information; users should aim at populating all green cells.
  - Blue cells: contain information often unavailable; by default contain LIDC averages and may be left as defaults if data is scarce.
  - Red cells: contain parameters governing fiscal adjustment rules; do not affect simulation results but may need adjustment if the toolkit fails to converge to a stable and unique solution. Users should not update red cells unless the toolkit fails to find a solution.
  - Hidden cells: govern additional model features not aligned with the toolkit’s main purpose; left for advanced users.
- Instruction: None of the colored cells should be left blank; choice of which cells to update relies on users’ judgment.

### Exogenous series worksheet (structure and mechanics)
- Fourteen exogenous series divided into five categories:
  1. Natural resource sector:
     - Natural resource output (YoY growth)
     - Natural resource price (level)
  2. Fiscal instruments:
     - Public investment (% of GDP)
     - Public investment efficiency (%)
     - Public consumption (% of GDP)
     - Transfers (% of GDP)
     - Change in the consumption tax rate (percentage points)
     - Change in the labor tax rate (percentage points)
  3. Indicators related to the financing of the public sector:
     - Grants (% of GDP)
     - Concessional debt (% of GDP)
     - Sovereign risk premium (% of GDP)
  4. Indicators affecting balance of payments:
     - Remittances (% of GDP)
     - Exports (% of GDP)
- For each exogenous series users can populate up to three options in the ‘Exogenous series’ worksheet and combine multiple assumptions.
- Initial values: model simulations rely on the initial values located on the row corresponding to horizon zero.
- Cell color conventions in the ‘Exogenous series’ worksheet:
  - Red cells: endogenized (should not be modified).
  - Green cells: values brought over from the ‘Calibration’ worksheet (should not be modified).
  - Blue cells: initial values that must be specified by users.
- Users can pick one of the three options for each exogenous series or keep the variable constant throughout the simulation horizon.

### Scenarios: configuration, limits, and special options
- Toolkit allows design and simulation of up to thirty scenarios.
- Users select scenarios to simulate by updating the ‘Simulate scenario’ row; all selected scenarios are simulated and saved in a single run.
- Controls: ‘Simulation horizon’ and ‘Starting year’ cells determine initial and final year of the simulation.
- Scenario customization: seventeen options; fourteen relate to exogenous series choices.
- Commercial borrowing: users can choose to allow accumulation of commercial borrowing or not. If allowed, users must specify the share of debt denominated in foreign currency over total commercial debt.
- Realism shocks: users can choose to correct model projections by feeding in implied shocks produced by the realism tool. Option available for Scenarios 2 – 30; Scenario 1 is the model-based baseline used by the realism tool.

### Toolkit functional modules
- Simulation tool:
  - Uses DIGNAR-19 to calculate dynamic paths of key macroeconomic variables conditional on user-supplied description, pandemic-related variables, and policy instruments.
  - Produces time series projections (e.g., debt-to-GDP dynamics) for alternative policy scenarios.
- Graphing tool:
  - Compares model-generated paths graphically (for example, debt-to-GDP dynamic paths under alternative policy formulations).
- Realism tool:
  - Provides consistency and realism checks by reverse-engineering shocks required to align model-based GDP and debt-to-GDP paths to projections obtained by alternative macro frameworks.
  - Examples: computes improvement in TFP necessary to match an optimistic GDP projection or computes improvement in the fiscal balance required to match more optimistic debt projections.
  - Particularly relevant for calibrating labor supply implications of the pandemic and matching GDP and debt-to-GDP paths; red cell adjustments may be required if the toolkit fails to find a solution.

### Outputs and reported labor-market indicators
- Simulation tool stores results in ‘outputs.xls’; each scenario’s output is stored in a separate worksheet named by scenario number.
- By default the toolkit stores projections of the following twenty-five macro indicators (exact names preserved):
  - Total GDP growth (YoY %)
  - Resource output growth (YoY %)
  - Resource price (level)
  - Resource revenue (% of tot. rev.)
  - Public investment to GDP (Δ from by, pp)
  - Public investment efficiency (%)
  - Public consumption to GDP (Δ from by, pp)
  - Transfers to GDP (Δ from by, pp)
  - Consumption tax rate (Δ from by, pp)
  - Labor income tax rate (Δ from by, pp)
  - Grants to GDP (Δ from by, pp)
  - Total public debt to GDP (Δ from by, pp)
  - Domestic debt to GDP (Δ from by, pp)
  - Foreign debt to GDP (Δ from by, pp)
  - Concessional debt to GDP (Δ from by, pp)
  - Net real interest rate (Δ from by, pp)
  - Sovereign risk premium (%)
  - Real exchange rate (%Δ from by)
  - Remittances to GDP (Δ from by, pp)
  - Exports to GDP (Δ from by, pp)
  - Current account deficit to GDP (Δ from by, pp)
  - Real wage (%Δ from by)
  - Labor (%Δ from by)
  - Private investment to GDP (Δ from by, pp)
  - Private consumption to GDP (Δ from by, pp)

### Labor markets: inversion, user input, and outputs
- Labor supply inversion:
  - Toolkit inverts the DGE model to determine a sequence of labor supply shocks that, absent other disturbances, would deliver the target change in labor supply.
  - Target labor supply change is decided by users and ideally guided by an external framework evaluating COVID-19 effects on labor supply.
  - The target specified in the ‘Exogenous Series’ worksheet will not coincide with the final labor supply projection delivered by the model; the final projection is a product of all assumptions in the ‘Exogenous series’ worksheet.
  - Option: assume no direct labor supply shocks due to the pandemic and only endogenous labor supply responses to other shocks, unless all other exogenous series are held constant.
- Exogenous series and labor:
  - Fourteen exogenous series can be combined; users can populate up to three options per series.
  - Initial values (horizon zero) are required and blue cells must be specified by users.
- Reported labor-market indicators (included among the twenty-five default indicators):
  - Real wage (%Δ from by)
  - Labor (%Δ from by)

### Graphing and visualization
- ‘Customized graphs’ worksheet:
  - Configure up to thirty-two graphs by filling rows for each graph.
  - For each graph choose scenarios to be plotted under the ‘Scenarios’ column; template accommodates up to four scenario choices per graph.
  - Each graph can accommodate up to 12 variables presented as individual subplots; variable selection by inputting codes from the codebook.
  - Users can specify graph dimensions by selecting numbers of rows and columns (examples: three-by-two or six-by-one layouts).
  - Graphing tool can combine up to four scenarios and up to thirty-two variables in a single graph.
- Legends:
  - Legends are not available in the case of a single scenario—even if the user specifies a legend, it will not be added to the graph.

### Running the graphing tool (procedure)
- STEP 2: Populate the ‘input.xlsx’ spreadsheet (worksheets: ‘Customized graphs’).
- STEP 3: Save changes to the ‘input.xlsx’ spreadsheet.
- STEP 4: Open Matlab and navigate to the working folder (use ‘Browse for folder’ icon and ‘Select Folder’).
- STEP 5: Run ‘plotgraphs.m’ script by typing its name (without file extension) in the Matlab command window and hit enter.
- STEP 6: Follow on-screen instructions; toolkit will ask user to confirm that the ‘input.xlsx’ file was saved.
- Saving produced figure via Matlab GUI:
  - STEP 1: Click on the ‘File’ button.
  - STEP 2: Select option ‘Save as’.
  - STEP 3: Type a name and choose the format for the graph.
  - STEP 4: Click on the ‘Save’ button.

### Examples illustrating usage
- Example 3: Plotting select macro variables (customized graphs)
  - Objective: Generate a 2 by 2 graph that plots total GDP growth, total debt-to-GDP, labor supply, and real wage over time.
  - Required setup:
    - ‘Customized graphs’ must reflect Scenario 1 and variable codes 9,13, 25, 26.
    - Codes found in the codebook available in ‘input.xlsx’.
  - Precondition: Simulation results should be obtained first using the simulation tool.
  - Note: Legends are not available for a single scenario.

- Example 4: Scenario comparison (overlaying scenarios)
  - Scenario descriptions:
    - Scenario 1: Assumes a fall in both price of oil and output of the natural resource sector; remaining exogenous series set constant.
    - Scenario 2: Corresponds to Scenario 1, and additionally assumes an increase in public investment—a 5% increase in the public investment to GDP ratio for five years.
  - Graph interpretation:
    - Black bold line: Scenario 1.
    - Blue dashed line: Scenario 2.
    - Observation: Public investment stimulus improves economic outlook but substantially increases total public debt.

### The realism tool: purpose, workflow, and convergence notes
- Purpose:
  - Cross-check projections of GDP growth and debt from other macro frameworks against the model-based ones and, if chosen, align them by reverse-engineering shocks to TFP and the fiscal balance.
- Usefulness:
  - Uncovers implicit assumptions in alternative macro frameworks (e.g., whether assumptions imply unrealistic shocks to TFP and the fiscal balance).
  - Acts as limited proxy for shocks or mechanisms not embedded in the DGE model when alternative frameworks condition on realizations not included in DIGNAR-19.
- Running the realism tool — five steps:
  - STEP 1: Populate ‘input.xlsx’ (worksheets: ‘Calibration’, ‘Exogenous series’, ‘Scenarios’, and ‘External baseline’).
  - STEP 2: Save changes to ‘input.xlsx’.
  - STEP 3: Open Matlab and navigate to the working folder.
  - STEP 4: Run ‘calib_baseline.m’ script by typing its name (without file extension) in the Matlab command window and hit enter.
  - STEP 5: Follow on-screen instructions; toolkit will confirm ‘input.xlsx’ was saved and evaluate it, advising if corrections are needed.
- Example 5: Uncovering implicit assumptions (alignment)
  - Objective: Compare model-based projections (Scenario 1 as ‘Model-based baseline’) with more optimistic user-provided projections (entered in ‘External baseline’) and align by solving for TFP and fiscal balance shocks.
  - Outputs and workflow:
    - Realism tool produces a graph: black bold line = user-provided projections; green bold line = DIGNAR-19 model paths.
    - User can choose to perform alignment or abort.
    - If alignment selected, tool inverts DGE model to solve for sequences of TFP and fiscal balance shocks that bring model projection to the user-provided one.
- Algorithmic and convergence notes:
  - Realism and simulation tools are not fully automated; operation is conditional on appropriate fiscal reaction parameters and exogenous shock magnitudes.
  - Fiscal reaction parameters (red in ‘Calibration’) do not affect simulated series over the plotted projection horizon but are important for solving the model (perfect foresight paths).
  - Convergence is not always guaranteed.
  - Remedies to improve convergence include increasing fiscal reaction parameter sizes or decreasing magnitudes of swings in exogenous series.
  - Caution: This approach should not substitute for thorough scenario design; exogenous series must deliver a consistent and realistic macroeconomic scenario for the model to be solvable (e.g., financing for increased public expenditure must be specified).

### Using realism-tool shocks in simulations
- Implied shocks computed by the realism tool are automatically saved.
- Workflow constraints:
  - Realism tool must be used first to compute and save shocks; then simulation tool can utilize them.
  - Scenarios 2-30 can accommodate these saved shocks.
  - Specification of Scenario 1 must remain the same as when realism tool computed the shocks.
  - If model calibration or Scenario 1 changes, the toolkit will deem saved shock sequences invalid and abort the simulation; user must re-run realism tool to compute updated shocks.
- Example application:
  - Use shock sequences from Example 5 to supplement Scenario 2 from Example 2 by selecting option E.2 in the ‘Scenarios’ worksheet to instruct the toolkit to use the saved shocks; simulation then produces projections for Scenario 2 that use the implied shocks.

*Source: tnmea2021007 - References (DIGNAR-19 toolkit user guide excerpt).*

### References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

### tnmea2021007 - References (DIGNAR-19 toolkit user guide excerpt)

### Toolkit purpose and scope
- DIGNAR-19 is a Dynamic General Equilibrium (DGE) model of a real small open economy developed at the International Monetary Fund to help country teams with quantitative macroeconomic assessments and policy scenario analysis in Low-Income Developing Countries (LIDCs) and Emerging Markets (EMs) during the COVID-19 pandemic.
- DIGNAR-19 is an extension of the DIGNAR model (which itself is an extension of the DIG model by Buffie and others, 2012; Zanna and others, 2019) that accommodates the effects of the COVID-19 pandemic.
- DIGNAR-19 is an acronym that stands for Debt, Investment, Growth, NAtural Resources and COVID-19.
- The toolkit helps users do policy scenario analysis by incorporating pandemic-associated shocks and producing macroeconomic projections with emphasis on GDP growth and government debt, using an internally consistent general equilibrium framework.
- Over the past eight years, DIG and DIGNAR models complemented the IMF and World Bank Debt Sustainability Framework (DSF) analysis, with over 65 country applications.

### Toolkit components and requirements
- The toolkit provides a user-friendly Excel-based interface that translates inputs into instructions for Matlab/Dynare programs executed behind the scenes.
- Users need Excel, Matlab, and Dynare installed on their computer.
- The toolkit was designed to operate on Matlab version 2019b and Dynare version 4.5.6.

### High-level structure of the Excel interface
- The Excel interface consists of two files: an input file and an output file.
- The input file is named ‘input.xlsx’ and contains five worksheets: ‘Calibration’, ‘Exogenous series’, ‘Scenarios’, ‘Customized graphs’, and ‘External baseline’.
- The output file is named ‘outputs.xls’; each worksheet in this file contains macroeconomic projections based on a single scenario. If the user specifies five scenarios in the ‘Scenario’ worksheet, the simulation tool saves projections for these scenarios in five separate worksheets named using the respective scenario number.

### Calibration worksheet (user inputs)
- Purpose: tune the DIGNAR-19 model to a specific country application.
- The toolkit identifies five calibration groups:
  - National accounting
  - Interest rates
  - Structural parameters
  - Natural resource sector
  - Fiscal policy
- The calibration worksheet uses four cell types to guide user input:
  - Green cells: contain highly country-specific information; users should aim at populating all green cells.
  - Blue cells: contain information often unavailable; by default these contain LIDC averages and may be left as defaults if data is scarce.
  - Red cells: contain parameters governing fiscal adjustment rules; these do not affect simulation results but may need adjustment if the toolkit fails to converge to a stable and unique solution. Users should not update the red cells unless the toolkit fails to find a solution for the DGE model.
  - Hidden cells: govern additional model features not aligned with the toolkit’s main purpose; left for advanced users who may wish to modify the underlying DGE model.
- None of the colored cells should be left blank; the choice of which cells to update and the values to input relies on users’ judgment.

### Exogenous series worksheet (user-imposed projected paths)
- The toolkit accommodates fourteen exogenous series divided into five categories:

1. Natural resource sector:
  - Natural resource output (YoY growth)
  - Natural resource price (level)

2. Fiscal instruments:
  - Public investment (% of GDP)
  - Public investment efficiency (%)
  - Public consumption (% of GDP)
  - Transfers (% of GDP)
  - Change in the consumption tax rate (percentage points)
  - Change in the labor tax rate (percentage points)

3. Indicators related to the financing of the public sector:
  - Grants (% of GDP)
  - Concessional debt (% of GDP)
  - Sovereign risk premium (% of GDP)

4. Indicators affecting balance of payments:
  - Remittances (% of GDP)
  - Exports (% of GDP)

### Toolkit functional modules
- Simulation tool:
  - Leverages the DIGNAR-19 model to calculate dynamic paths of key macroeconomic variables conditional on user-supplied information (description of the economy, paths of pandemic-related variables, and policy instruments).
  - Produces time series projections (e.g., debt-to-GDP dynamics) for alternative policy scenarios.

- Graphing tool:
  - Helps compare model-generated paths graphically (for example, debt-to-GDP dynamic paths under alternative policy formulations).

- Realism tool:
  - Provides consistency and realism checks by reverse-engineering shocks required to align model-based GDP and debt-to-GDP paths to projections obtained by alternative macro frameworks (such as those generated by country teams).
  - Examples: computes the improvement in TFP necessary to match an optimistic projection of GDP or computes the improvement in the fiscal balance required to match more optimistic debt projections.
  - The realism tool is particularly relevant when calibrating labor supply implications of the pandemic and using the realism tool to match GDP and debt-to-GDP paths; red cell adjustments may be required if the toolkit fails to find a solution.

### User workflow (brief)
- Download the zip archive and extract contents into a working folder.
- Populate the ‘input.xlsx’ worksheets (Calibration, Exogenous series, Scenarios, Customized graphs, External baseline) as appropriate for the exercise.
- Run the backend Matlab/Dynare routines (the toolkit minimizes required Matlab knowledge to opening Matlab, navigating to the working folder and submitting inputs via the command window).
- Review outputs in ‘outputs.xls’ and in customized graphs generated by the graphing tool.

*Source: tnmea2021007 - References (DIGNAR-19 toolkit user guide excerpt).*

### 5.  Labor markets:

### 5.  Labor markets:

### Labor supply change: inversion and user input
- The toolkit inverts the DGE model to determine a sequence of labor supply shocks that would, in the absence of other disturbances, deliver the target change in the labor supply.
- The target labor supply change is decided by users and ideally guided by an external framework aimed at evaluating the effect of the COVID-19 pandemic on the country’s labor supply.
- The target labor supply change specified in the ‘Exogenous Series’ worksheet will not coincide with the final labor supply projection delivered by the model.
- The final labor supply projection will be a product of all assumptions specified in the ‘Exogenous series’ worksheet.
- In the case of the labor supply change, one option is to assume no labor supply shocks due to the pandemic, but only an endogenous response of the labor supply to other shocks as standard in DGE models.
- Unless all the exogenous series apart from the labor supply change are set to remain constant.

### Exogenous series, initial values, and worksheet mechanics
- There are fourteen exogenous series in the DIGNAR-19 model; for each, users can populate up to three options in the ‘Exogenous series’ worksheet and combine multiple assumptions.
- The model simulations rely on the initial values of the exogenous series located on the row corresponding to horizon zero.
- Cell color conventions in the ‘Exogenous series’ worksheet:
  - Red cells: endogenized (should not be modified).
  - Green cells: values brought over from the ‘Calibration’ worksheet (should not be modified).
  - Blue cells: initial values that must be specified by users.
- Users can pick one of the three options provided for each exogenous series or choose to keep the variable constant throughout the simulation horizon.

### Scenarios: configuration and limits
- The toolkit allows for the design and simulation of up to thirty scenarios by selecting options in the ‘Scenario’ worksheet.
- Users pick which scenarios to simulate by updating the ‘Simulate scenario’ row; all selected scenarios are simulated and saved in a single run.
- The ‘Simulation horizon’ and ‘Starting year’ cells determine the initial and final year of the proposed simulation.
- Scenarios can be customized through seventeen options; fourteen of these are related to the choice of the exogenous series.
- Users can choose to allow for accumulation of commercial borrowing or not. If allowed, users must specify the share of debt denominated in foreign currency over total commercial debt.
- Users can choose to correct model projections by feeding in the implied shocks produced by the realism tool. This option is available for Scenarios 2 – 30; Scenario 1 is the model-based baseline used by the realism tool as a benchmark.

### Outputs and reported labor-market indicators
- The simulation tool produces dynamic paths of macro indicators using the DIGNAR-19 model and stores them in ‘output.xls’; each simulated scenario’s output is stored in a separate worksheet named by scenario number.
- By default, the toolkit stores the projections of the following twenty-five macro indicators (exact names preserved):
  - Total GDP growth (YoY %)
  - Resource output growth (YoY %)
  - Resource price (level)
  - Resource revenue (% of tot. rev.)
  - Public investment to GDP (Δ from by, pp)
  - Public investment efficiency (%)
  - Public consumption to GDP (Δ from by, pp)
  - Transfers to GDP (Δ from by, pp)
  - Consumption tax rate (Δ from by, pp)
  - Labor income tax rate (Δ from by, pp)
  - Grants to GDP (Δ from by, pp)
  - Total public debt to GDP (Δ from by, pp)
  - Domestic debt to GDP (Δ from by, pp)
  - Foreign debt to GDP (Δ from by, pp)
  - Concessional debt to GDP (Δ from by, pp)
  - Net real interest rate (Δ from by, pp)
  - Sovereign risk premium (%)
  - Real exchange rate (%Δ from by)
  - Remittances to GDP (Δ from by, pp)
  - Exports to GDP (Δ from by, pp)
  - Current account deficit to GDP (Δ from by, pp)
  - Real wage (%Δ from by)
  - Labor (%Δ from by)
  - Private investment to GDP (Δ from by, pp)
  - Private consumption to GDP (Δ from by, pp)

### Graphing and visualization relevant to labor-market outputs
- The ‘Customized graphs’ worksheet allows users to configure up to thirty-two graphs by filling in rows for each graph.
- For each graph, users must choose the scenarios to be plotted under the ‘Scenarios’ column; the template accommodates up to four scenario choices per graph.
- Each graph can accommodate up to 12 variables presented as individual subplots; variable selection is executed by inputting codes from the codebook.
- Users can specify graph dimensions by selecting numbers of rows and columns (e.g., three-by-two or six-by-one layouts).
- The graphing tool takes simulation results as input and can combine up to four scenarios and up to thirty-two variables in a single graph.

*Source: tnmea2021007 - 5.  Labor markets*

### Section 3.2 for the instructions on running the simulation tool.

### Section 3.2 for the instructions on running the simulation tool.

### Running the graphing tool: procedure
- STEP 2: Populate the ‘input.xlsx’ spreadsheet (worksheets: ‘Customized graphs’).
- STEP 3: Save changes to the ‘input.xlsx’ spreadsheet.
- STEP 4: Open Matlab on your computer and navigate to the working folder. To do so, click on the ‘Browse for folder’ icon, find the folder containing toolkit files, and click the ‘Select Folder’ button.
- STEP 5: Run ‘plotgraphs.m’ script. To run a Matlab script simply type its name (without the file extension) in the Matlab command window and hit enter.
- STEP 6: Follow on-screen instructions. The toolkit will ask the user to confirm that the ‘input.xlsx’ file was saved.

### Example 3: Plotting select macro variables (customized graphs)
- Objective: Generate a 2 by 2 graph that plots total GDP growth, total debt-to-GDP, labor supply, and real wage over time.
- Required setup:
  - The ‘Customized graphs’ worksheet must reflect that we are interested in Scenario 1 and the variable codes 9,13, 25, 26.
  - Codes can be found in the codebook available in the ‘input.xlsx’ file.
- Precondition: Simulation results should be obtained first using the simulation tool (assumes Example 1 instructions were executed beforehand).
- Notes on output:
  - Legends are not available in the case of a single scenario—even if the user specifies a legend, it will not be added to the graph.
- Saving the produced figure (via Matlab GUI):
  - STEP 1: Click on the ‘File’ button.
  - STEP 2: Select option ‘Save as’.
  - STEP 3: Type a name and choose the format for the graph.
  - STEP 4: Click on the ‘Save’ button.

### Example 4: Scenario comparison (overlaying scenarios)
- Scenario descriptions:
  - Scenario 1: Assumes a fall in both price of oil and output of the natural resource sector, the remaining exogenous series are set constant.
  - Scenario 2: Corresponds to Scenario 1, and additionally assumes an increase in public investment—a 5% increase in the public investment to GDP ratio for five years.
- Setup: Use the same graph format and list of variables as in Example 3; configure the ‘Customized graphs’ worksheet to include both scenarios.
- Interpretation of resulting graph:
  - The black bold line corresponds to Scenario 1.
  - The blue dashed line corresponds to Scenario 2.
  - Observation: The public investment stimulus improves the economic outlook but also substantially increases total public debt.

### The realism tool: overview
- Purpose:
  - Helps cross-check projections of GDP growth and debt from other macro frameworks against the model-based ones.
  - Allows users to choose to align these projections; in this case the realism tool reverse-engineers shocks to Total Factor Productivity (TFP) and the fiscal balance to achieve alignment.
- Usefulness:
  - Uncovers implicit assumptions in alternative macro frameworks (e.g., whether assumptions are too optimistic by implying unrealistic shocks to TFP and the fiscal balance).
  - Acts as limited proxies for shocks or mechanisms not embedded in the DGE model when alternative frameworks condition on realizations not included in the DIGNAR-19 model.
- Initiation: Populate the ‘input.xlsx’ file, submit a command in the Matlab command window, and follow on-screen instructions.

### Running the realism tool: procedure
- There are five steps necessary to run the tool:
  - STEP 1: Populate the ‘input.xlsx’ spreadsheet (worksheets: ‘Calibration’, ‘Exogenous series’, ‘Scenarios’, and ‘External baseline’).
  - STEP 2: Save changes to the ‘input.xlsx’ spreadsheet.
  - STEP 3: Open Matlab on your computer and navigate to the working folder. To do so, click on the ‘Browse for folder’ icon, find the folder containing toolkit files, and click the ‘Select Folder’ button.
  - STEP 4: Run ‘calib_baseline.m’ script. To run a Matlab script simply type its name (without the file extension) in the Matlab command window and hit enter.
  - STEP 5: Follow on-screen instructions. The toolkit will ask the user to confirm that the ‘input.xlsx’ file was saved. Then it will evaluate the ‘input.xlsx’ file and advise the user if it needs corrections.

### Example 5: Uncovering implicit assumptions (alignment)
- Objective: Compare model-based projections of debt-to-GDP and GDP growth with those produced by an alternative macro framework; align the model-based projections to the alternative framework to quantify implicit assumptions as shocks to TFP and the fiscal balance.
- Preconditions and setup:
  - Use Scenario 1 from Example 1 as the ‘Model-based baseline’ in the ‘Scenarios’ worksheet.
  - Input the more optimistic user-provided projections into the ‘External baseline’ worksheet of the ‘input.xlsx’ file.
  - The ‘Calibration’, ‘Exogenous series’, and ‘Scenarios’ worksheets remain the same as in Example 1.
- Workflow and outputs:
  - The realism tool produces a graph comparing the two baselines: the black bold line plots the more optimistic user-provided projections; the green bold line shows DIGNAR-19 model paths.
  - The interface provides a choice to perform the alignment or abort.
  - If alignment is selected, the tool inverts the DGE model to solve for sequences of TFP and fiscal balance shocks that bring the model-based projection to the user-provided one.
- Algorithmic and convergence notes:
  - The realism and simulation tools are not fully automated; their operation is conditional on the right set of fiscal policy reaction parameters and exogenous shock magnitudes.
  - Fiscal reaction parameters (highlighted in red in the ‘Calibration’ worksheet) do not affect simulated series over the plotted projection horizon but play an important role in solving the model (solving for perfect foresight paths).
  - Convergence of the algorithm is not always guaranteed.
  - Remedies that often help convergence include increasing the size of the fiscal reaction parameters or decreasing the magnitudes of the swings in exogenous series.
  - Caution: This approach should not substitute for thorough scenario design. The specified combination of exogenous series must deliver a consistent (and realistic) macroeconomic scenario for the model to be solvable (e.g., if public expenditure is assumed to increase in the future, the scenario should allow for accumulation of government debt or an increase in government revenues, or both, to finance such an increase).

### Example 6: Using the shocks stored by the realism tool
- Storage and reuse:
  - Implied shocks computed by the realism tool are automatically saved by the toolkit.
  - Users can introduce these shocks in their simulations performed by the simulation tool by selecting an appropriate option in the ‘Scenarios’ worksheet.
- Workflow constraints:
  - The realism tool should be used first to compute and save the shocks. Only after that can the simulation tool utilize them.
  - Scenarios 2-30 can accommodate these shocks in the simulations.
  - The specification of Scenario 1 (the Model-based baseline) must remain the same as when the realism tool was used to compute the shocks.
  - If the calibration of the model or the specification of Scenario 1 change, the toolkit will acknowledge that the setup used to compute the saved shock sequences is no longer valid; the simulation will be aborted and the user will be asked to use the realism tool again to compute updated shock sequences.
- Example application:
  - Use the shock sequences computed in Example 5 to supplement Scenario 2 from Example 2 by selecting option E.2 in the ‘Scenarios’ worksheet to instruct the toolkit to use the saved shocks in the simulation.
  - Triggering the simulation tool will produce projections for Scenario 2 that make use of the implied shocks computed using the realism tool.

*Source: IMF staff. TNM/2021/007*

---


_Source: https://www.imf.org/-/media/files/publications/tnm/2021/english/tnmea2021007.pdf_
