library(ggplot2)
library(patchwork)
# Shared theme
th <- theme_minimal(base_size = 9) +
theme(panel.grid.minor = element_blank(),
plot.title = element_text(hjust = 0.5, face = "bold", size = 9.5),
axis.title = element_text(size = 8),
plot.margin = margin(4, 8, 4, 4))
# ── Coordinates (X = Rice, Y = Machines; Salvatore Fig. 5.4 convention)
# India PPF: M = 120√(1-(R/200)²), Pa slope = -0.6
# USA PPF: M = 200√(1-(R/120)²), Pa* slope = -5/3; Pw = -1
# U = R*M: IC1 (U=12000) tangent to Pa at A AND Pa* at A* (same curve!)
# IC2 (U=13596) tangent to Pw at E = E* (same point, by symmetry)
A_R <- 200 / sqrt(2) # India autarky A ≈ (141.4, 84.9)
A_M <- 120 / sqrt(2)
B_R <- sqrt(14400 / 0.4896) # India production B ≈ (171.5, 61.7)
B_M <- 0.36 * B_R
Pw_c <- B_R + B_M # Pw intercept ≈ 233.2
E_R <- Pw_c / 2 # Shared consumption E = E* ≈ (116.6, 116.6)
E_M <- Pw_c / 2
U1 <- A_R * A_M # IC1 ≈ 12000
U2 <- E_R * E_M # IC2 ≈ 13596
As_R <- A_M; As_M <- A_R # USA autarky A* ≈ ( 84.9, 141.4)
Bs_R <- B_M; Bs_M <- B_R # USA production B* ≈ ( 61.7, 171.5)
rg <- seq(1, 230, len = 900) # shared R grid
# Both panels share the same axes and both PPFs
india_ppf <- geom_line(
data = data.frame(R = seq(1,200,len=500), M = 120*sqrt(1-(seq(1,200,len=500)/200)^2)),
aes(R, M), color = "#012169", linewidth = 1.4)
usa_ppf <- geom_line(
data = data.frame(R = seq(1,120,len=500), M = 200*sqrt(1-(seq(1,120,len=500)/120)^2)),
aes(R, M), color = "#B22234", linewidth = 1.4)
# ── Panel 1: Before Trade (Autarky) ───────────────────────────────────────────
p1 <- ggplot() +
india_ppf + usa_ppf +
# Pa (India, slope -0.6, tangent at A)
geom_line(data = data.frame(R=rg, M=pmax(0, A_M + 0.6*(A_R - rg))),
aes(R,M), color="#012169", linewidth=0.85, linetype="dashed") +
# Pa* (USA, slope -5/3, tangent at A*)
geom_line(data = data.frame(R=rg, M=pmax(0, As_M + (5/3)*(As_R - rg))),
aes(R,M), color="#B22234", linewidth=0.85, linetype="dashed") +
# IC1 — same hyperbola tangent to Pa at A and Pa* at A*
geom_line(data = data.frame(R=rg, M=U1/rg), aes(R,M),
color="#2E7D32", linewidth=0.95) +
# Key points
geom_point(aes(A_R, A_M), color="#012169", size=3.0, shape=16) +
geom_point(aes(As_R, As_M), color="#B22234", size=3.0, shape=16) +
# Point labels
annotate("text", x=A_R+8, y=A_M+9, label="A", fontface="bold", size=3.5, color="#012169") +
annotate("text", x=As_R-16, y=As_M+8, label="A*", fontface="bold", size=3.5, color="#B22234") +
# Price line labels
annotate("text", x=196, y=A_M+0.6*(A_R-196)+7,
label="Pa", size=3.0, color="#012169", hjust=1, fontface="italic") +
annotate("text", x=108, y=As_M+(5/3)*(As_R-108)+8,
label="Pa*", size=3.0, color="#B22234", hjust=0, fontface="italic") +
annotate("text", x=175, y=U1/175+10, label="IC1", size=3.0, color="#2E7D32", fontface="italic") +
# Country PPF labels
annotate("text", x=183, y=120*sqrt(1-(183/200)^2)+9,
label="India", size=3.2, color="#012169", fontface="bold") +
annotate("text", x=35, y=200*sqrt(1-(35/120)^2)+9,
label="USA", size=3.2, color="#B22234", fontface="bold") +
scale_x_continuous(expand=c(0,0)) + scale_y_continuous(expand=c(0,0)) +
coord_cartesian(xlim=c(0,225), ylim=c(0,215)) +
labs(title="Before Trade (Autarky)", x="Rice", y="Machines") + th
# ── Panel 2: After Trade (Free Trade) ─────────────────────────────────────────
p2 <- ggplot() +
india_ppf + usa_ppf +
# Pw (slope -1, shared world price through B, B*, E)
geom_line(data = data.frame(R=rg, M=pmax(0, Pw_c - rg)), aes(R,M),
color="#C8952A", linewidth=1.0, linetype="dashed") +
# IC1 (faint reference)
geom_line(data = data.frame(R=rg, M=U1/rg), aes(R,M),
color="grey70", linewidth=0.7, linetype="dotted") +
# IC2 — tangent to Pw at E (= E*)
geom_line(data = data.frame(R=rg, M=U2/rg), aes(R,M),
color="#2E7D32", linewidth=0.95) +
# Trade triangle: India (blue) B → (E_R, B_M) → E
annotate("segment", x=B_R, xend=E_R, y=B_M, yend=B_M,
color="#012169", linewidth=0.9, arrow=arrow(length=unit(0.14,"cm"), ends="last")) +
annotate("segment", x=E_R, xend=E_R, y=B_M, yend=E_M,
color="#012169", linewidth=0.9, arrow=arrow(length=unit(0.14,"cm"), ends="last")) +
# Trade triangle: USA (red) B* → (Bs_R, E_M) → E*
annotate("segment", x=Bs_R, xend=Bs_R, y=Bs_M, yend=E_M,
color="#B22234", linewidth=0.9, arrow=arrow(length=unit(0.14,"cm"), ends="last")) +
annotate("segment", x=Bs_R, xend=E_R, y=E_M, yend=E_M,
color="#B22234", linewidth=0.9, arrow=arrow(length=unit(0.14,"cm"), ends="last")) +
# Key points
geom_point(aes(B_R, B_M), color="#012169", size=3.0, shape=16) +
geom_point(aes(Bs_R, Bs_M), color="#B22234", size=3.0, shape=16) +
geom_point(aes(E_R, E_M), color="#C8952A", size=3.5, shape=16) +
# Point labels
annotate("text", x=B_R+8, y=B_M+8, label="B", fontface="bold", size=3.5, color="#012169") +
annotate("text", x=Bs_R-16, y=Bs_M+8, label="B*", fontface="bold", size=3.5, color="#B22234") +
annotate("text", x=E_R+9, y=E_M+8, label="E/E*", fontface="bold", size=3.5, color="#C8952A") +
# Price / IC labels
annotate("text", x=207, y=Pw_c-207+7, label="Pw", size=3.0, color="#C8952A", hjust=1, fontface="italic") +
annotate("text", x=170, y=U2/170+10, label="IC2", size=3.0, color="#2E7D32", fontface="italic") +
annotate("text", x=170, y=U1/170-10, label="IC1", size=3.0, color="grey60", fontface="italic") +
# Trade flow labels
annotate("text", x=(B_R+E_R)/2, y=B_M-10,
label="India exports rice", size=2.5, hjust=0.5, color="#012169") +
annotate("text", x=Bs_R-5, y=(Bs_M+E_M)/2,
label="USA exports\nmachines", size=2.5, hjust=1, color="#B22234") +
# Country PPF labels
annotate("text", x=183, y=120*sqrt(1-(183/200)^2)+9,
label="India", size=3.2, color="#012169", fontface="bold") +
annotate("text", x=35, y=200*sqrt(1-(35/120)^2)+9,
label="USA", size=3.2, color="#B22234", fontface="bold") +
scale_x_continuous(expand=c(0,0)) + scale_y_continuous(expand=c(0,0)) +
coord_cartesian(xlim=c(0,225), ylim=c(0,215)) +
labs(title="After Trade (Free Trade)", x="Rice", y="Machines") + th
# ── Combine ────────────────────────────────────────────────────────────────────
p1 + p2 +
plot_annotation(
caption = "After Salvatore, Fig. 5.4",
theme = theme(plot.caption = element_text(hjust = 0.5, size = 7.5))
)