set.seed(42)
t <- seq(-5, 14, by = 0.2)
# J-curve shape: initial deterioration then improvement
# TB(t<0) = 0 (baseline)
# After depreciation at t=0:
# short run (0-3 months): TB falls (pre-set contracts, inelastic demand)
# medium (3-12 months): TB recovers as quantities adjust
# long run (12+ months): TB improves above baseline if M-L holds
tb_j <- ifelse(
t < 0, 0,
ifelse(
t < 3,
-4 * (t/3), # deterioration phase
ifelse(
t < 8,
-4 + 5 * ((t - 3)/5), # recovery phase
1 + 0.3 * (t - 8) # long-run improvement
)
)
)
# Add some noise for realism
tb_j <- tb_j + c(rep(0, sum(t < 0)), rnorm(sum(t >= 0), 0, 0.15))
df <- data.frame(time = t, tb = tb_j)
ggplot(df, aes(x = time, y = tb)) +
geom_line(color = "#012169", linewidth = 2) +
geom_hline(yintercept = 0, linetype = "dashed", color = "grey50", linewidth = 0.8) +
geom_vline(xintercept = 0, linetype = "dashed", color = "red", linewidth = 1.2) +
# Shaded deterioration region
geom_ribbon(
data = df |> filter(time >= 0 & time <= 4),
aes(ymin = pmin(tb, 0), ymax = 0),
fill = "#cc0000", alpha = 0.2
) +
# Shaded improvement region
geom_ribbon(
data = df |> filter(time > 4),
aes(ymin = 0, ymax = pmax(tb, 0)),
fill = "#012169", alpha = 0.15
) +
# Annotations
annotate("text", x = 0.3, y = 3.8,
label = "Depreciation\noccurs (t=0)", color = "red", size = 3.5, hjust = 0) +
annotate("text", x = -3.5, y = 0.4,
label = "Pre-depreciation\nbaseline", size = 3, color = "grey40") +
annotate("text", x = 1.5, y = -2.8,
label = "Short-run\ndeterioration\n(contracts pre-set,\nM-L not satisfied)",
size = 3, color = "#cc0000", hjust = 0.5) +
annotate("text", x = 11, y = 2.2,
label = "Long-run\nimprovement\n(M-L holds,\nquantities adjust)",
size = 3, color = "#012169", hjust = 0.5) +
annotate("segment",
x = 1.5, y = -2.3, xend = 1.5, yend = -1,
arrow = arrow(length = unit(0.25, "cm")), color = "#cc0000") +
annotate("segment",
x = 11, y = 1.8, xend = 11, yend = 0.6,
arrow = arrow(length = unit(0.25, "cm")), color = "#012169") +
# Phase labels
annotate("text", x = 1.5, y = -4.3,
label = "Phase I:\n0-3 months", size = 2.8, color = "#cc0000") +
annotate("text", x = 5.5, y = -4.3,
label = "Phase II:\n3-12 months\n(recovery)", size = 2.8, color = "#B9975B") +
annotate("text", x = 11, y = -4.3,
label = "Phase III:\n12+ months\n(improvement)", size = 2.8, color = "#012169") +
scale_x_continuous(breaks = seq(-4, 14, 2),
labels = paste0(seq(-4, 14, 2), "m")) +
scale_y_continuous(limits = c(-5.5, 5)) +
labs(
title = "The J-Curve Effect",
subtitle = "Trade balance worsens before improving after currency depreciation\nM-L condition (|eX|+|eM|>1) is satisfied only in the long run",
x = "Time (months after depreciation)", y = "Trade Balance (change from baseline)"
) +
theme_minimal(base_size = 11)