import React, { useState } from 'react'; import { ArrowRight, TrendingUp, TrendingDown, LineChart } from 'lucide-react'; const MonetaryPolicyDiagram = () => { const [activeScenario, setActiveScenario] = useState('expansion'); const [showGraphs, setShowGraphs] = useState(false); // Graph parameters const [moneySupply, setMoneySupply] = useState(100); const [income, setIncome] = useState(100); const [foreignRate, setForeignRate] = useState(2); const [inflation, setInflation] = useState(2); const [outputGap, setOutputGap] = useState(0); // Calculate equilibrium interest rate from money market const calcInterestRate = (ms, y) => { // L(R,Y) = k1*Y - k2*R, where k1=0.5, k2=20 // Money market equilibrium: Ms/P = L(R,Y) // Assuming P=1 for simplicity: Ms = k1*Y - k2*R // R = (k1*Y - Ms)/k2 const k1 = 0.5; const k2 = 20; const rate = Math.max(0, (k1 * y - ms) / k2); return rate; }; // Calculate exchange rate from UIP const calcExchangeRate = (domesticRate, foreignRate) => { // Simplified: E = base * (1 + rate_differential) // Higher domestic rate → currency appreciates → E falls const base = 1.0; const rateDiff = domesticRate - foreignRate; return base * Math.exp(-rateDiff * 0.1); // E decreases when R_dom > R_for }; // Calculate Taylor Rule rate const calcTaylorRate = (inflationRate, inflationTarget, outputGap) => { const rStar = 2; // equilibrium rate const fPi = 1.5; const fY = 0.5; return rStar + fPi * (inflationRate - inflationTarget) + fY * outputGap; }; const domesticRate = calcInterestRate(moneySupply, income); const exchangeRate = calcExchangeRate(domesticRate, foreignRate); const taylorRate = calcTaylorRate(inflation, 2, outputGap); // Generate points for money demand curve const generateMoneyDemandCurve = (y) => { const points = []; for (let r = 0; r <= 8; r += 0.2) { const md = 0.5 * y - 20 * r; // L(R,Y) = k1*Y - k2*R if (md > 0) { points.push({ r, md }); } } return points; }; // Generate points for UIP curve const generateUIPCurve = (rFor) => { const points = []; for (let rDom = 0; rDom <= 8; rDom += 0.2) { const e = calcExchangeRate(rDom, rFor); points.push({ rDom, e }); } return points; }; const moneyDemandPoints = generateMoneyDemandCurve(income); const uipPoints = generateUIPCurve(foreignRate); const scenarios = { expansion: { title: 'Monetary Expansion (Ms ↑)', color: 'blue', steps: [ { label: 'Central Bank', action: 'Increases Money Supply (Ms ↑)', color: 'bg-blue-100' }, { label: 'Money Market', action: 'Interest Rate Falls (R ↓)', color: 'bg-blue-200' }, { label: 'FX Market', action: 'Currency Depreciates (E ↑)', color: 'bg-blue-300' }, { label: 'Real Economy', action: 'Investment ↑, Exports ↑, AD ↑', color: 'bg-blue-400' } ] }, contraction: { title: 'Monetary Contraction (Ms ↓)', color: 'red', steps: [ { label: 'Central Bank', action: 'Decreases Money Supply (Ms ↓)', color: 'bg-red-100' }, { label: 'Money Market', action: 'Interest Rate Rises (R ↑)', color: 'bg-red-200' }, { label: 'FX Market', action: 'Currency Appreciates (E ↓)', color: 'bg-red-300' }, { label: 'Real Economy', action: 'Investment ↓, Exports ↓, AD ↓', color: 'bg-red-400' } ] }, taylor: { title: 'Taylor Rule Response to High Inflation', color: 'orange', steps: [ { label: 'Shock', action: 'Inflation Above Target (π > π*)', color: 'bg-orange-100' }, { label: 'Taylor Rule', action: 'R = R* + 1.5(π - π*) + 0.5(y - y*)', color: 'bg-orange-200' }, { label: 'Policy Action', action: 'Raise R aggressively (by > 1% per 1% inflation)', color: 'bg-orange-300' }, { label: 'Effect', action: 'Real Rate ↑ → Borrowing ↓ → AD ↓ → π ↓', color: 'bg-orange-400' } ] } }; return (

Monetary Policy Transmission Mechanism

{/* Scenario Selector */}
{/* Interactive Graphs Section */} {showGraphs && (

Interactive Graph Plotter

{/* Controls */}
{/* Money Supply Slider */}
setMoneySupply(Number(e.target.value))} className="w-full" />
Increase → R↓, E↑ (depreciation)
{/* Income Slider */}
setIncome(Number(e.target.value))} className="w-full" />
Increase → Money demand↑ → R↑
{/* Foreign Rate Slider */}
setForeignRate(Number(e.target.value))} className="w-full" />
Increase → Domestic currency appreciates
{/* Inflation Slider */}
setInflation(Number(e.target.value))} className="w-full" />
Target: 2% | Current deviation: {(inflation - 2).toFixed(1)}%
{/* Output Gap Slider */}
setOutputGap(Number(e.target.value))} className="w-full" />
Positive = overheating | Negative = recession
{/* Results Display */}
Current Values:
Interest Rate: {domesticRate.toFixed(2)}%
Exchange Rate: {exchangeRate.toFixed(3)}
Taylor Rate: {taylorRate.toFixed(2)}%
Real Rate: {(domesticRate - inflation).toFixed(2)}%
{/* Graphs */}
{/* Money Market Graph */}

Money Market Equilibrium

{/* Axes */} {/* Labels */} Real Money (M/P) Interest Rate (R) {/* Money Demand Curve */} `${i === 0 ? 'M' : 'L'} ${50 + p.md * 2.5} ${250 - p.r * 25}` ).join(' ')}`} stroke="blue" strokeWidth="3" fill="none" /> {/* Money Supply Line (vertical) */} {/* Equilibrium Point */} {/* Legend */} L(R,Y) - Demand Ms/P - Supply Equilibrium
Equilibrium: R = {domesticRate.toFixed(2)}% where money supply meets money demand
{/* Exchange Rate Graph */}

Interest Parity & Exchange Rate

{/* Axes */} {/* Labels */} Domestic Interest Rate Exchange Rate (E) {/* UIP Curve */} `${i === 0 ? 'M' : 'L'} ${50 + p.rDom * 35} ${250 - p.e * 150}` ).join(' ')}`} stroke="purple" strokeWidth="3" fill="none" /> {/* Current Point */} {/* Foreign Rate Reference Line */} {/* Legend */} UIP Condition Current (R, E) Foreign R
UIP: RCHF ({domesticRate.toFixed(2)}%) vs REUR ({foreignRate.toFixed(1)}%) → E = {exchangeRate.toFixed(3)} {domesticRate > foreignRate ? '(CHF strong)' : '(CHF weak)'}
{/* Taylor Rule Graph */}

Taylor Rule Policy Response

{/* Axes */} {/* Grid lines */} {/* Labels */} Inflation - Target (%) Policy Rate (%) {/* Taylor Rule Line for current output gap */} {[-3, -2, -1, 0, 1, 2, 3].map((inflDev, idx, arr) => { if (idx === arr.length - 1) return null; const nextInflDev = arr[idx + 1]; const r1 = 2 + 1.5 * inflDev + 0.5 * outputGap; const r2 = 2 + 1.5 * nextInflDev + 0.5 * outputGap; return ( ); })} {/* Current Position */} {/* Target inflation line */} {/* Legend */} π = π* (target) Current policy
Taylor Rule: R = 2% + 1.5×({(inflation-2).toFixed(1)}%) + 0.5×({outputGap.toFixed(1)}%) = {taylorRate.toFixed(2)}%
Real rate = {(taylorRate - inflation).toFixed(2)}%
{/* GDP Components Impact */}

Policy Impact on GDP Components

{/* Calculate impacts based on current settings */} {(() => { const baseline = 100; const rateEffect = (domesticRate - 2) * -5; // Higher R reduces spending const exRateEffect = (1 - exchangeRate) * 100; // Appreciation reduces NX const consumption = Math.max(0, baseline + rateEffect * 0.3); const investment = Math.max(0, baseline + rateEffect * 1.0); const government = baseline; // Assumed constant const netExports = Math.max(-50, baseline + exRateEffect); const bars = [ { label: 'C', value: consumption, color: '#3b82f6', x: 70 }, { label: 'I', value: investment, color: '#8b5cf6', x: 150 }, { label: 'G', value: government, color: '#10b981', x: 230 }, { label: 'NX', value: netExports, color: '#f59e0b', x: 310 } ]; return ( <> {/* Baseline line */} Baseline {/* Bars */} {bars.map((bar, idx) => { const height = Math.abs(bar.value - baseline) * 1.5; const y = bar.value >= baseline ? 150 - height : 150; return ( {bar.label} {bar.value.toFixed(0)} ); })} {/* Axis */} GDP = C + I + G + NX ); })()}
Interest Rate Effect: R↑ reduces C and I (especially I)
Exchange Rate Effect: Strong currency reduces NX
Higher R = {domesticRate.toFixed(2)}% → Tighter policy → Lower GDP
{/* Interactive Tips */}

💡 Try These Scenarios:

📈 Monetary Expansion: Increase money supply to 130 → Watch R fall and E rise (depreciation)
📉 Fight Inflation: Set inflation to 4% → See Taylor rule prescribe higher R to cool economy
🌍 Foreign Rate Shock: Raise foreign rate to 4% → Domestic currency strengthens
📊 Recession Response: Set output gap to -3% → Taylor rule suggests lower rates
)} {/* Active Scenario Flow */}

{scenarios[activeScenario].title}

{scenarios[activeScenario].steps.map((step, idx) => (
{step.label}
{step.action}
{idx < scenarios[activeScenario].steps.length - 1 && ( )}
))}
{/* Main Relationships Diagram */}

Core Relationships & Formulas

{/* Money Market Equilibrium */}

Money Market Equilibrium

Ms/P = L(R, Y)
Ms: Money Supply (set by CB)
P: Price Level (sticky short-run)
R: Interest Rate (adjusts to clear market)
Y: Real Income
Key: R ↑ → L(R,Y) ↓ (inverse relationship)
Y ↑ → L(R,Y) ↑ (positive relationship)
{/* Uncovered Interest Parity */}

Uncovered Interest Parity (UIP)

RCHF = REUR + (Ee - E)/E
RCHF: Domestic interest rate
REUR: Foreign interest rate
E: Current exchange rate (CHF/EUR)
Ee: Expected future exchange rate
Key: If RCHF ↑ → CHF appreciates (E ↓)
Returns must equalize across currencies
{/* Taylor Rule */}

Taylor Rule

R = R* + fπ(π - π*) + fy(y - y*)
R*: Equilibrium rate
π: Current inflation, π*: Target (2%)
y: Output, y*: Potential output
fπ = 1.5 (inflation response)
fy = 0.5 (output response)
Key: fπ {'>'} 1 ensures real rate rises
when inflation ↑ to cool economy
{/* National Income Identity */}

National Income Identity

Y = C + I + G + CA
Y: GDP/National Income
C: Consumption (~51%)
I: Investment (~27%, most volatile)
G: Government purchases (~12%)
CA: Current Account (~10%)
Saving Identity: S = I + CA
Save domestically (I) or abroad (CA)
{/* Transmission Channels */}

Monetary Policy Transmission Channels

{/* Interest Rate Channel */}

Interest Rate Channel

Policy Rate ↑
All Rates ↑
Borrowing Costs ↑
Investment ↓
Consumption ↓
Aggregate Demand ↓
{/* Exchange Rate Channel */}

Exchange Rate Channel

Rdomestic ↑
Currency Appreciates
Exports ↓
Imports ↑
Net Exports ↓
Aggregate Demand ↓
{/* Wealth/Asset Channel */}

Wealth/Asset Channel

Interest Rates ↑
Bond Prices ↓
Stock Prices ↓
Household Wealth ↓
Consumption ↓
Aggregate Demand ↓
{/* Key Takeaways */}

Key Takeaways

); }; export default MonetaryPolicyDiagram;