cor1 <- "dodgerblue" # Bentham
cor2 <- "firebrick" # Rawls
cor3 <- "forestgreen" # Nash
# UPF: u_B = 10 - 0.1 u_A^2
df_upf <- data.frame(u_A = seq(0, 10, length.out = 200)) |>
mutate(u_B = 10 - 0.1 * u_A^2)
# Pontos ótimos
ua_b <- 5
ub_b <- 7.5
ua_r <- 5 * (sqrt(5) - 1)
ub_r <- ua_r
ua_n <- 10 / sqrt(3)
ub_n <- 10 - 0.1 * ua_n^2
opts <- data.frame(
u_A = c(ua_b, ua_r, ua_n),
u_B = c(ub_b, ub_r, ub_n),
rule = c("Bentham", "Rawls", "Nash")
)
# Curvas de indiferença social tangentes
W_b <- ua_b + ub_b # 12.5
df_ic_b <- data.frame(u_A = seq(0, 12.5, length.out = 100)) |>
mutate(u_B = W_b - u_A) |>
filter(u_B >= 0, u_B <= 11)
# Rawls: "L" no ponto (ua_r, ub_r) — dois segmentos para evitar
# que geom_line conecte os endpoints e dobre o segmento vertical
df_ic_r <- rbind(
data.frame(u_A = ua_r, u_B = seq(ua_r, 11, length.out = 50), seg = "v"),
data.frame(u_A = seq(ua_r, 11, length.out = 50), u_B = ua_r, seg = "h")
)
# Nash: u_A * u_B = W_n
W_n <- ua_n * ub_n
df_ic_n <- data.frame(u_A = seq(0.5, 11, length.out = 200)) |>
mutate(u_B = W_n / u_A) |>
filter(u_B <= 11)
ggplot() +
geom_line(data = df_upf, aes(u_A, u_B), color = "black", linewidth = 1.2) +
geom_line(data = df_ic_b, aes(u_A, u_B), color = cor1, linewidth = 0.8, linetype = "dashed") +
geom_line(data = df_ic_r, aes(u_A, u_B, group = seg), color = cor2, linewidth = 0.8, linetype = "dashed") +
geom_line(data = df_ic_n, aes(u_A, u_B), color = cor3, linewidth = 0.8, linetype = "dashed") +
geom_point(data = opts[opts$rule == "Bentham", ], aes(u_A, u_B), color = cor1, size = 4) +
geom_point(data = opts[opts$rule == "Rawls", ], aes(u_A, u_B), color = cor2, size = 4) +
geom_point(data = opts[opts$rule == "Nash", ], aes(u_A, u_B), color = cor3, size = 4) +
annotate("text", x = 10.8, y = 10.5,
label = sprintf("Bentham (%.2f, %.2f)", ua_b, ub_b),
color = cor1, hjust = 1) +
annotate("text", x = 10.8, y = 9.8,
label = sprintf("Rawls (%.2f, %.2f)", ua_r, ub_r),
color = cor2, hjust = 1) +
annotate("text", x = 10.8, y = 9.1,
label = sprintf("Nash (%.2f, %.2f)", ua_n, ub_n),
color = cor3, hjust = 1) +
geom_abline(slope = 1, intercept = 0, color = "gray70", linetype = "dotted") +
coord_fixed(xlim = c(0, 11), ylim = c(0, 11), expand = FALSE) +
labs(title = "UPF e ótimos sob três funções de bem-estar social",
subtitle = TeX("UPF: $u_B = 10 - 0{,}1\\, u_A^2$"),
x = TeX("$u_A$"), y = TeX("$u_B$")) +
theme_minimal(base_size = 13) +
theme(axis.line = element_line(color = "black", linewidth = 0.8))