# Réplica da Fig 5.4 de Nicholson — aumento de preço p_x: 1 -> 4
# Curvas de indiferença Cobb-Douglas U = sqrt(xy) => y = U^2/x
# U_1 = 2 => y = 4/x (curva original, passa por A = (4,1) e B = (2,2))
# U_2 = 1 => y = 1/x (curva final, passa por C = (1,1))
# Retas orçamentárias:
# Original (p_x=1, p_y=4, I=8): x + 4y = 8 -> de (0,2) a (8,0)
# Nova (p_x=4, p_y=4, I=8): 4x + 4y = 8 -> de (0,2) a (2,0)
# Auxiliar (novos preços, renda compensada I_aux = 16, tangente a U_1 em B):
# 4x + 4y = 16 -> de (0,4) a (4,0)
ggplot() +
# Eixos explícitos em x = 0 e y = 0 (retas orçamentárias terminam em y = 0,
# enquanto o painel se estende até y = -0,8 para acomodar os colchetes ES/ER)
geom_hline(yintercept = 0, color = "black", linewidth = 0.8) +
geom_vline(xintercept = 0, color = "black", linewidth = 0.8) +
# Curvas de indiferença
geom_function(fun = \(x) 4 / x, xlim = c(0.35, 8.5),
color = "blue", linewidth = 0.9) +
geom_function(fun = \(x) 1 / x, xlim = c(0.15, 8.5),
color = "blue", linewidth = 0.9) +
# Reta orçamentária original: x + 4y = 8
geom_segment(aes(x = 0, y = 2, xend = 8, yend = 0),
color = "black", linewidth = 0.9) +
# Nova reta orçamentária: 4x + 4y = 8 (mais íngreme)
geom_segment(aes(x = 0, y = 2, xend = 2, yend = 0),
color = "black", linewidth = 0.9) +
# Reta auxiliar (renda compensada): 4x + 4y = 16, tangente a U_1 em B
geom_segment(aes(x = 0, y = 4, xend = 4, yend = 0),
color = "gray40", linewidth = 0.7, linetype = "dashed") +
# Pontos A, B, C
geom_point(aes(x = 4, y = 1), color = "red", size = 3.5) +
geom_point(aes(x = 2, y = 2), color = "darkgreen", size = 3.5) +
geom_point(aes(x = 1, y = 1), color = "purple", size = 3.5) +
# Rótulos dos pontos
annotate("text", x = 4.35, y = 1.25, label = "A = (4, 1)",
color = "red", size = 4, hjust = 0) +
annotate("text", x = 2.25, y = 2.30, label = "B = (2, 2)",
color = "darkgreen", size = 4, hjust = 0) +
annotate("text", x = 1.25, y = 1.30, label = "C = (1, 1)",
color = "purple", size = 4, hjust = 0) +
# Rótulos das curvas de indiferença
annotate("text", x = 7.6, y = 4 / 7.6 + 0.25,
label = latex2exp::TeX(r"($U_1 = 2$)"),
color = "blue", size = 4, hjust = 0) +
annotate("text", x = 7.6, y = 1 / 7.6 + 0.25,
label = latex2exp::TeX(r"($U_2 = 1$)"),
color = "blue", size = 4, hjust = 0) +
# Caixa com parâmetros do exercício no canto superior direito
annotate("rect", xmin = 5.15, xmax = 8.95,
ymin = 2.25, ymax = 4.92,
fill = "grey97", color = "grey60",
linewidth = 0.3, alpha = 0.9) +
annotate("text", x = 5.35, y = 4.70,
label = "Parâmetros:",
hjust = 0, size = 3.8, fontface = "bold") +
annotate("text", x = 5.35, y = 4.37,
label = latex2exp::TeX(r"($U(x, y) = \sqrt{x \, y}$)"),
hjust = 0, size = 3.6) +
annotate("text", x = 5.35, y = 4.07,
label = latex2exp::TeX(r"($p_y = 4, \; I = 8$)"),
hjust = 0, size = 3.6) +
annotate("text", x = 5.35, y = 3.77,
label = latex2exp::TeX(r"($p_x: 1 \rightarrow 4$ \ (\it{aumento}))"),
hjust = 0, size = 3.6) +
annotate("text", x = 5.35, y = 3.35,
label = "Retas orçamentárias:",
hjust = 0, size = 3.8, fontface = "bold") +
annotate("text", x = 5.35, y = 3.05,
label = latex2exp::TeX(r"(Original: $1x + 4y = 8$)"),
hjust = 0, size = 3.4) +
annotate("text", x = 5.35, y = 2.75,
label = latex2exp::TeX(r"(Nova: $4x + 4y = 8$)"),
hjust = 0, size = 3.4) +
annotate("text", x = 5.35, y = 2.45,
label = latex2exp::TeX(r"(Auxiliar: $4x + 4y = 16$ \ (\it{pontilhada}))"),
hjust = 0, size = 3.4) +
# Projeções tracejadas dos pontos até o eixo x
geom_segment(aes(x = 1, y = 0, xend = 1, yend = 1),
color = "purple", linewidth = 0.4, linetype = "dotted") +
geom_segment(aes(x = 2, y = 0, xend = 2, yend = 2),
color = "darkgreen", linewidth = 0.4, linetype = "dotted") +
geom_segment(aes(x = 4, y = 0, xend = 4, yend = 1),
color = "red", linewidth = 0.4, linetype = "dotted") +
# Colchete ES: de x_B = 2 a x*_A = 4 (efeito substituição)
annotate("segment", x = 2, xend = 4, y = -0.35, yend = -0.35,
color = "darkgreen", linewidth = 0.8,
arrow = arrow(ends = "both", length = unit(0.15, "cm"))) +
annotate("text", x = 3, y = -0.60,
label = latex2exp::TeX(r"(ES $= -2$)"),
color = "darkgreen", size = 3.8) +
# Colchete ER: de x*_C = 1 a x_B = 2 (efeito renda)
annotate("segment", x = 1, xend = 2, y = -0.35, yend = -0.35,
color = "purple", linewidth = 0.8,
arrow = arrow(ends = "both", length = unit(0.15, "cm"))) +
annotate("text", x = 1.5, y = -0.60,
label = latex2exp::TeX(r"(ER $= -1$)"),
color = "purple", size = 3.8) +
scale_x_continuous(
expand = c(0, 0),
limits = c(0, 9),
breaks = seq(0, 8, 1)
) +
scale_y_continuous(
expand = c(0, 0),
limits = c(-0.8, 5),
breaks = seq(0, 5, 1)
) +
labs(
x = latex2exp::TeX(r"($x$)"),
y = latex2exp::TeX(r"($y$)"),
title = latex2exp::TeX(r"(Decomposição: aumento de preço $p_x$: $1 \to 4$)")
) +
theme_minimal() +
theme(
axis.line = element_blank(),
panel.grid = element_blank()
)