Introduction
In this tutorial, we'll explore how to build and analyze economic forecasting models using Python, similar to the approach taken by Anthropic in their recent economic scenario modeling. We'll focus on creating a multi-scenario economic model that can help evaluate different projections, including extreme scenarios like those mentioned in the article about Anthropic's CEO Dario Amodei's warnings. This tutorial will teach you how to implement scenario analysis, visualize economic projections, and understand the implications of different economic growth models.
Prerequisites
- Basic Python knowledge (variables, loops, functions)
- Familiarity with NumPy and Pandas for data manipulation
- Understanding of basic economic concepts (GDP growth, unemployment rates)
- Python libraries: numpy, pandas, matplotlib, seaborn
Step-by-Step Instructions
1. Set Up Your Environment
First, we'll install and import the necessary libraries. This creates a foundation for our economic modeling work.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Set style for better visualization
sns.set_style("whitegrid")
plt.rcParams['figure.figsize'] = (12, 8)
2. Define Economic Parameters
We'll establish the base parameters for our economic model, including growth rates and unemployment projections.
# Economic parameters
base_gdp_growth = 2.5 # Annual GDP growth rate in percent
base_unemployment = 4.0 # Base unemployment rate in percent
years = 20 # Number of years to project
# Scenario definitions
scenarios = {
'conservative': {'gdp_growth': 1.5, 'unemployment_rate': 5.0},
'moderate': {'gdp_growth': 2.5, 'unemployment_rate': 4.0},
'extreme': {'gdp_growth': 4.0, 'unemployment_rate': 17.9}
}
3. Create Economic Growth Model
Now we'll implement a function that projects economic indicators over time based on different scenarios. This is crucial for understanding how different assumptions lead to different outcomes.
def project_economy(scenario_name, params, years=20):
"""Project economic indicators for a given scenario"""
gdp_growth = params['gdp_growth']
unemployment_rate = params['unemployment_rate']
# Create timeline
years_list = list(range(2024, 2024 + years))
# Project GDP (assuming compound growth)
gdp_base = 25000 # Base GDP in billions
gdp_projection = [gdp_base]
for i in range(1, years):
gdp_projection.append(gdp_projection[-1] * (1 + gdp_growth/100))
# Project unemployment (assuming it's inversely related to growth)
unemployment_projection = [unemployment_rate]
for i in range(1, years):
# Simple model: unemployment decreases with growth
new_unemployment = max(0, unemployment_rate - (gdp_growth * 0.5))
unemployment_projection.append(new_unemployment)
# Create DataFrame
df = pd.DataFrame({
'Year': years_list,
'GDP_Billions': gdp_projection,
'Unemployment_Rate': unemployment_projection
})
return df
4. Generate All Scenario Projections
We'll run our model for all three scenarios to see how different assumptions affect economic outcomes.
# Generate projections for all scenarios
projections = {}
for scenario_name, params in scenarios.items():
projections[scenario_name] = project_economy(scenario_name, params, years)
# Display first few rows of each projection
for name, df in projections.items():
print(f"{name.upper()} Scenario:")
print(df.head())
print()
5. Visualize the Projections
Visualization is key to understanding how different scenarios play out. This helps make the implications of extreme scenarios more tangible.
# Create subplots for visualization
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 6))
# GDP Projection
for scenario_name, df in projections.items():
ax1.plot(df['Year'], df['GDP_Billions'], marker='o', linewidth=2, label=scenario_name)
ax1.set_title('Projected GDP Growth (Billions USD)')
ax1.set_xlabel('Year')
ax1.set_ylabel('GDP (Billions USD)')
ax1.legend()
ax1.grid(True)
# Unemployment Projection
for scenario_name, df in projections.items():
ax2.plot(df['Year'], df['Unemployment_Rate'], marker='s', linewidth=2, label=scenario_name)
ax2.set_title('Projected Unemployment Rate')
ax2.set_xlabel('Year')
ax2.set_ylabel('Unemployment Rate (%)')
ax2.legend()
ax2.grid(True)
plt.tight_layout()
plt.show()
6. Analyze Scenario Differences
Let's examine the key differences between scenarios, particularly focusing on the extreme scenario that aligns with Anthropic's CEO's warnings.
# Calculate key metrics for each scenario
metrics = {}
for scenario_name, df in projections.items():
final_gdp = df['GDP_Billions'].iloc[-1]
final_unemployment = df['Unemployment_Rate'].iloc[-1]
# Calculate growth rate over the period
initial_gdp = df['GDP_Billions'].iloc[0]
total_growth = (final_gdp - initial_gdp) / initial_gdp * 100
metrics[scenario_name] = {
'Final_GDP': final_gdp,
'Final_Unemployment': final_unemployment,
'Total_Growth_Percent': total_growth
}
# Create comparison DataFrame
metrics_df = pd.DataFrame(metrics).T
print("Scenario Comparison Metrics:")
print(metrics_df)
7. Create Scenario Risk Analysis
Let's add a risk analysis component that shows how the extreme scenario differs from others in terms of economic volatility.
# Calculate volatility (standard deviation of annual growth rates)
volatility_metrics = {}
for scenario_name, df in projections.items():
# Calculate annual growth rates
annual_growth = []
for i in range(1, len(df)):
growth_rate = (df['GDP_Billions'].iloc[i] / df['GDP_Billions'].iloc[i-1] - 1) * 100
annual_growth.append(growth_rate)
volatility = np.std(annual_growth)
volatility_metrics[scenario_name] = volatility
print("Volatility Analysis:")
for scenario, vol in volatility_metrics.items():
print(f"{scenario}: {vol:.2f}% annual volatility")
8. Interpret Results in Context
Finally, let's create a summary that puts our findings in context with the Anthropic example.
# Create summary interpretation
print("\nEconomic Scenario Analysis Summary:")
print("=====================================")
print("The extreme scenario (4.0% GDP growth, 17.9% unemployment) represents")
print("an outlier projection that aligns with warnings about potential economic")
print("disruption. While the moderate scenario shows stable growth, the extreme")
print("scenario demonstrates the potential consequences of rapid technological")
print("disruption on employment markets, as referenced in the Anthropic article.")
# Show the specific extreme scenario values
extreme_scenario = projections['extreme']
print(f"\nExtreme Scenario Results (2030):")
print(f"GDP: ${extreme_scenario['GDP_Billions'].iloc[-1]:.1f} billion")
print(f"Unemployment: {extreme_scenario['Unemployment_Rate'].iloc[-1]:.1f}%")
print("\nThis scenario demonstrates the importance of scenario planning")
print("in economic forecasting, particularly for understanding potential")
print("outlier outcomes that may require different policy responses.")
Summary
In this tutorial, we've built a multi-scenario economic model that demonstrates how different assumptions about growth rates and unemployment can lead to vastly different economic projections. We've implemented a framework similar to what companies like Anthropic might use to analyze potential economic outcomes, including extreme scenarios that could represent outlier forecasts.
The key learning points include:
- How to structure economic forecasting models with multiple scenarios
- Using Python to project economic indicators over time
- Visualizing economic trends to better understand scenario implications
- Comparing different scenarios to identify risk factors and outlier outcomes
This approach is particularly valuable for understanding how AI-driven economic disruption might affect employment markets, as highlighted in the Anthropic article. The framework can be extended to include more complex economic indicators and additional variables for even more sophisticated analysis.



