Skip to content

Command-line interface

The principle-viz command runs the calculations of this manual from the shell and prints the result as JSON; --output also writes it to a file. It draws no figures. Install it as a tool (Installing the command-line tool), or prefix each command with uv run inside a project.

principle-viz equilibrium \
  --demand-intercept 10 --demand-slope -1 \
  --supply-intercept 2 --supply-slope 1
{
  "q_star": 4.0,
  "p_star": 6.0,
  "is_valid_market": true,
  "notes": []
}

Market arguments

Most commands describe the market by two lines in inverse form, \(p = a + b Q\):

Price intercept \(a\) of demand.

Slope \(b\) of demand.

Price intercept \(a\) of supply.

Slope \(b\) of supply.

Also write the JSON to this file, creating its directory.

Commands

CLI commands lists the calculation and options of each command; the calculation of each is described in its chapter.

Linear equilibrium

Section — Linear markets

Comparative statics: --demand-delta-intercept, --demand-delta-slope, --supply-delta-intercept, --supply-delta-slope

Section — Comparative statics

Discrete market: --demand-values, --supply-values, --price-rule {midpoint,lower,upper}

Section — Discrete markets

Point elasticity: --intercept, --slope, --quantity; arc elasticity with --q1, --p1

Section — Elasticity and total revenue

Elasticity and revenue schedule: --samples

Section — Elasticity and total revenue

Surplus: --policy {baseline,tax,subsidy,control} with the options of that policy

Section — Welfare

One-row DWL report: --policy {tax,subsidy,control}, --csv

Section — Welfare

--tax-type {fixed,per_unit,ad_valorem}, --amount, --tax-on {consumer,producer}

Section — Taxes and subsidies

--amount, --subsidy-to {consumer,producer}

Section — Taxes and subsidies

--control-type {ceiling,floor}, --control-price

Section — Price controls

--world-price, --tariff, --import-quota, --quota-rent-recipient

Section — International trade

--external-cost, --external-benefit

Section — Market failures

--congestion-cost

Section — Market failures

--benefit-intercepts, --benefit-slopes, --cost-intercept, --cost-slope, --samples

Section — Market failures

--labor-demand-*, --labor-supply-*, --minimum-wage

Section — Labor and loanable funds

--savings-*, --investment-*, --savings-shift, --investment-shift, --government-borrowing

Section — Labor and loanable funds

--x-intercept, --y-intercept, --curvature, --x-good, --y-good, --x-growth, --y-growth, --samples

Section — Production possibilities

principle-viz <command> --help lists every option of a command.

principle-viz tax \
  --demand-intercept 10 --demand-slope -1 \
  --supply-intercept 2 --supply-slope 1 \
  --tax-type per_unit --amount 1 --tax-on producer

The output holds the untaxed equilibrium (baseline_equilibrium), the taxed one (post_tax) and the changes, as compare_tax_scenario() returns them. Here the quantity is 3.5, the consumer price 6.5 and the producer price 5.5.

Comments