Scenario Simulation

results_no_adapt <- simulate_multiple_runs(n = 100, run_adaptation = FALSE,
                                           years = 40,
                                           gdp_init = gdp_init,
                                           debt_init = debt_init,
                                           rev_ratio = rev_ratio,
                                           spend_ratio = spend_ratio,
                                           shock_prob = shock_prob,
                                           shock_loss_pct = shock_loss_pct,
                                           emergency_spend_pct = emergency_spend_pct,
                                           adaptation_cost_pct = adaptation_cost_pct,
                                           adaptation_years = adaptation_years,
                                           adaptation_effectiveness = adaptation_effectiveness)

results_adapt <- simulate_multiple_runs(n = 100, run_adaptation = TRUE,
                                        years = 40,
                                        gdp_init = gdp_init,
                                        debt_init = debt_init,
                                        rev_ratio = rev_ratio,
                                        spend_ratio = spend_ratio,
                                        shock_prob = shock_prob,
                                        shock_loss_pct = shock_loss_pct,
                                        emergency_spend_pct = emergency_spend_pct,
                                        adaptation_cost_pct = adaptation_cost_pct,
                                        adaptation_years = adaptation_years,
                                        adaptation_effectiveness = adaptation_effectiveness)

all_results <- rbind(results_no_adapt, results_adapt)
# Show how often shocks occurred in each scenario
table(all_results$Scenario, all_results$Shock)
##                
##                 FALSE TRUE
##   Adaptation     2370 1630
##   No Adaptation  2370 1630

Debt-to-GDP trajectories

# 1. Average across simulations
avg_trend <- all_results %>%
  group_by(year, Scenario) %>%
  summarise(debt = median(Debt_to_GDP), .groups = "drop") #since median is robust to extreme GDP collapses

# 2. Widen into columns: one per scenario
debt_wide <- avg_trend %>%
  pivot_wider(names_from = Scenario, values_from = debt)

# 3. Calculate the difference: NoAdapt - Adapt
debt_wide <- debt_wide %>%
  mutate(gap = `No Adaptation` - Adaptation)

ggplot(avg_trend, aes(x = year, y = debt, color = Scenario)) +
  geom_line(size = 1.2) +
  labs(
    title = "Median Debt-to-GDP Ratio Over Time (100 Simulations)",
    subtitle = "Adaptation increases debt burden due to front-loaded spending and limited offset from shocks",
    y = "Debt-to-GDP Ratio", x = "Year",
    caption = "Shows the median debt ratio each year across \n100 runs. Adaptation increases fiscal pressure \nwithout reversing the trend by year 40."
  ) +
  theme_minimal() +
  theme(plot.caption = element_text(size = 9, hjust = 0)
  )
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

GDP Plot

ggplot(all_results, aes(x = year, y = GDP, color = Scenario)) +
  geom_line(alpha = 0.3) +
  stat_summary(fun = median, geom = "line", size = 1.2) +
  labs(
    title = "Simulated GDP Paths Over Time",
    subtitle = "Adaptation helps preserve economic output by reducing climate shock impacts",
    y = "GDP (normalized)", x = "Year",
    caption = "Thin lines show individual simulations; bold line shows \nmedian GDP path. Adaptation preserves \nGDP more effectively over time."
  ) +
  theme_minimal() +
  theme(plot.caption = element_text(size = 9, hjust = 0)
  )

💸 Nominal Debt Plot

ggplot(all_results, aes(x = year, y = Debt, color = Scenario)) +
  geom_line(alpha = 0.3) +
  stat_summary(fun = median, geom = "line", size = 1.2) +
  labs(
    title = "Simulated Government Debt Over Time",
    subtitle = "Adaptation raises total debt through additional spending, with partial offset from avoided shocks",
    y = "Nominal Debt", x = "Year",
    caption = "Adaptation scenarios accumulate more debt due \nto upfront investment. Benefits are not large \nenough to lower total debt within 40 years."
  ) +
  theme_minimal() +
  theme(plot.caption = element_text(size = 9, hjust = 0)
  )

🔁 Debt Gap Plot

ggplot(debt_wide, aes(x = year, y = gap)) +
  geom_line(color = "steelblue", size = 1.2) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "gray") +
  labs(
    title = "Difference in Debt Burden (No Adaptation – Adaptation)",
    subtitle = "Positive values imply adaptation reduces debt burden; declining line indicates narrowing benefit",
    y = "Δ Debt-to-GDP Ratio", x = "Year",
    caption = "Adaptation initially narrows the debt gap,\n but does not deliver net savings in this setup. \nThe benefit flattens or reverses in later years."
  ) +
  theme_minimal() +
  theme(plot.caption = element_text(size = 9, hjust = 0)
  )

Interpretation

Interpretation