You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a unified price-effect decomposition pipeline that splits the total effect of a price change into substitution effect and income effect, supporting both Hicks (utility-compensated) and Slutsky (purchasing-power-compensated) compensation rules, and renders the canonical three-bundle / two-arrow diagram on a single Canvas.
Consolidates and supersedes the decomposition portions of #6 and #32; uses #13 (Slutsky matrix) as the underlying derivative engine; provides the diagram component referenced by #20.
Motivation
Price-effect decomposition is the core teaching exercise in chapters 5–8 of every intermediate microeconomics textbook (Varian, Mankiw, Mas-Colell). The library can already plot equilibria but has no way to draw the standard A → B → C three-bundle picture with substitution and income arrows. This is the highest-priority remaining gap for teaching consumer theory.
Background
For a price change $p_x^0 \to p_x^1$ (with $p_y$, $I$ fixed), define the compensated bundle $B$ differently for the two methods:
Method
Compensation rule
Compensated bundle $B$
Hicks
Adjust nominal income so the consumer reaches the original utility$U^0$ at new prices
$\arg\min_{x,y} p_x^1 x + p_y y ;;\text{s.t.};; U(x,y) = U^0$
Slutsky
Adjust nominal income so the consumer can just afford the original bundle$(x^0, y^0)$ at new prices
$\arg\max U(x,y) ;;\text{s.t.};; p_x^1 x + p_y y = p_x^1 x^0 + p_y y^0$
Both yield substitution effects in the same direction; magnitudes differ.
Proposed API
Solver
fromecon_viz.optimizerimportdecompose_price_effect, DecompositionMethodresult=decompose_price_effect(
model,
px=(2.0, 4.0), # before, afterpy=3.0,
income=60.0,
method=DecompositionMethod.HICKS, # or SLUTSKY
)
# result.A : Equilibrium — original optimum at p_x^0# result.B : Equilibrium — compensated optimum at p_x^1# result.C : Equilibrium — final optimum at p_x^1# result.substitution_effect : tuple[float, float] # A → B# result.income_effect : tuple[float, float] # B → C# result.total_effect : tuple[float, float] # A → C# result.method : DecompositionMethod# result.compensated_income : float
Arrow + bracket styling lives on `Theme` (separate colour / linewidth keys for substitution vs income).
Edge cases: corner solutions for $B$ (Hicks may have no interior optimum at extreme prices); Giffen goods (income arrow opposite to substitution arrow); inferior goods (income arrow shorter and possibly opposite).
Both methods must be testable against Cobb-Douglas closed forms.
Summary
Add a unified price-effect decomposition pipeline that splits the total effect of a price change into substitution effect and income effect, supporting both Hicks (utility-compensated) and Slutsky (purchasing-power-compensated) compensation rules, and renders the canonical three-bundle / two-arrow diagram on a single
Canvas.Consolidates and supersedes the decomposition portions of #6 and #32; uses #13 (Slutsky matrix) as the underlying derivative engine; provides the diagram component referenced by #20.
Motivation
Price-effect decomposition is the core teaching exercise in chapters 5–8 of every intermediate microeconomics textbook (Varian, Mankiw, Mas-Colell). The library can already plot equilibria but has no way to draw the standard A → B → C three-bundle picture with substitution and income arrows. This is the highest-priority remaining gap for teaching consumer theory.
Background
For a price change$p_x^0 \to p_x^1$ (with $p_y$ , $I$ fixed), define the compensated bundle $B$ differently for the two methods:
Both yield substitution effects in the same direction; magnitudes differ.
Proposed API
Solver
Canvas integration
What
add_decompositiondrawsImplementation notes
Sanity-check example
Cobb-Douglas with$\alpha = 0.5$ , $p_x: 2 \to 4$ , $p_y = 3$ , $I = 60$ :
Tasks
Related