Overview
Given a finite set of observed price–demand pairs ${(p^t, x^t)}_{t=1}^T$, visualise each budget line and chosen bundle, and annotate whether the dataset satisfies the Weak Axiom of Revealed Preference (WARP).
Background (MWG Ch. 2.F)
Direct revealed preference: $x^s \succ^R x^t$ if $x^s$ was chosen when $x^t$ was affordable:
$$p^s \cdot x^t \leq p^s \cdot x^s$$
WARP: if $x^s \succ^R x^t$, then $x^t \not\succ^R x^s$, i.e.:
$$p^t \cdot x^s > p^t \cdot x^t$$
A violation means the two budget lines "cross" in a way that is inconsistent with any well-behaved preference relation.
Proposed visualisation
- Draw each budget line $B^t$ (from $p^t$ and $I^t = p^t \cdot x^t$).
- Mark each chosen bundle $x^t$ as a point.
- For each pair $(s, t)$ where $x^s$ is affordable under $p^t$: draw a dashed line from $x^t$ to $x^s$ on $B^t$ and check the WARP condition.
- Colour pairs green if WARP is satisfied, red if violated.
- Print a summary:
WARP: ✓ satisfied or WARP: ✗ violated (pairs: [(s,t), ...])
API sketch
observations = [
{"px": 2, "py": 3, "x": 10, "y": 13.3},
{"px": 3, "py": 2, "x": 8, "y": 14.0},
]
canvas.plot_revealed_preference(observations)
# Returns WarpResult(satisfied=True/False, violations=[...])
Tasks
Overview
Given a finite set of observed price–demand pairs${(p^t, x^t)}_{t=1}^T$ , visualise each budget line and chosen bundle, and annotate whether the dataset satisfies the Weak Axiom of Revealed Preference (WARP).
Background (MWG Ch. 2.F)
Direct revealed preference:$x^s \succ^R x^t$ if $x^s$ was chosen when $x^t$ was affordable:
WARP: if$x^s \succ^R x^t$ , then $x^t \not\succ^R x^s$ , i.e.:
A violation means the two budget lines "cross" in a way that is inconsistent with any well-behaved preference relation.
Proposed visualisation
WARP: ✓ satisfiedorWARP: ✗ violated (pairs: [(s,t), ...])API sketch
Tasks
WarpResultdataclassplot_revealed_preferencemethod onCanvas