Skip to content

Production possibilities

ProductionPossibilitiesFrontier(
    x_intercept,
    y_intercept,
    curvature=1.0,
    x_good="Good X",
    y_good="Good Y"
)

Output of \(y\) when \(x\) units of the first good are produced.

Units of \(y\) given up for one more unit of \(x\), \(\left| \mathrm{d} y / \mathrm{d} x \right|\).

A PointStatus: EFFICIENT on the frontier, INEFFICIENT inside it, UNATTAINABLE outside.

The frontier

\[ y = Y (1 - (x / X)^c), \]

through the intercepts \(X\) and \(Y\). A curvature \(c = 1\) gives a straight line (constant opportunity cost); \(c > 1\) bows it out (increasing opportunity cost). Intercepts and curvature must be positive and \(c \ge 1\), otherwise PPFError is raised.

PointStatus
EFFICIENTPointStatus

On the frontier.

INEFFICIENTPointStatus

Inside the frontier.

UNATTAINABLEPointStatus

Outside the frontier.

Where a point lies relative to the frontier.

from principle_viz import ProductionPossibilitiesFrontier

ppf = ProductionPossibilitiesFrontier(
    10,
    8,
    curvature=2,
    x_good="Consumer goods",
    y_good="Capital goods",
)
# 5.12 0.96
print(ppf.y_at(6), ppf.opportunity_cost_x(6))
print(ppf.assess(4, 3), ppf.assess(7, 6))
# PointStatus.INEFFICIENT PointStatus.UNATTAINABLE

analyze_ppf(
    frontier,
    points=(),
    *,
    samples=101
)
ppf_canvas(
    result,
    *,
    title="Production Possibilities Frontier",
    theme=None,
    labels=None,
    visibility=None
)

Sample the frontier and assess named points, given as (x, y, label) triples; ppf_canvas(), in principle_viz.visuals.ppf, draws it with the attainable set shaded and the points labelled (Efficient and inefficient points). The figure title is the title argument: it defaults to "Production Possibilities Frontier", None draws no title and any other text is drawn as given. A default English title is translated into the figure's language.

from principle_viz import analyze_ppf
from principle_viz.visuals.ppf import ppf_canvas

points = ((6, ppf.y_at(6), "A"), (4, 3, "B"), (7, 6, "C"))
result = analyze_ppf(ppf, points=points)
ppf_canvas(result, title=None).save("ppf_points.png")

Efficient and inefficient points

Efficient and inefficient points

PPFGrowthScenario(x_growth_rate=0.0, y_growth_rate=0.0)
analyze_ppf_growth(
    frontier,
    scenario,
    *,
    samples=101
)
ppf_growth_canvas(
    result,
    *,
    title="Economic Growth",
    theme=None,
    labels=None,
    visibility=None
)

Economic growth scales each intercept by one plus its growth rate; the result holds the baseline and shifted frontiers and their sampled points. ppf_growth_canvas() draws both, named \(P P F_0\) and \(P P F_1\) (see Growth in consumer and capital goods). Its title works as for ppf_canvas(), with the default "Economic Growth".

Growth in consumer and capital goods

Growth in consumer and capital goods

Comparative advantage

compare_linear_ppfs(
    name_a,
    frontier_a,
    name_b,
    frontier_b
)

For two straight-line frontiers, the opportunity cost of \(x\) for each producer and who has the comparative advantage in each good ("tie" when the costs are equal). Curved frontiers raise PPFError.

from principle_viz import compare_linear_ppfs

# x costs 0.5 y
ann = ProductionPossibilitiesFrontier(10, 5)
# x costs 1 y
bob = ProductionPossibilitiesFrontier(6, 6)
result = compare_linear_ppfs("Ann", ann, "Bob", bob)
print(
    result.comparative_advantage_x,
    result.comparative_advantage_y,
)
# Ann Bob

Ann has the comparative advantage in \(x\) (0.5 against 1) and Bob in \(y\) (1 against 2).

Comments