Skip to content

Index number methods ​

JsIndexNum ports the 13 methods of PyIndexNum 0.4.0. Notation: $p_n^t$ and $q_n^t$ are the price and quantity of product $n$ in period $t$, $P(a,b)$ a bilateral index between periods $a$ and $b$.

Bilateral methods ​

Compare exactly two periods. Weighted methods need quantities; all bilateral functions accept balanced (require identical product sets, default true) and onWarning.

MethodFormulaWeights
Jevons$P_J = \left(\prod_{n} \tfrac{p_n^t}{p_n^0}\right)^{1/N}$unweighted
Carli$P_C = \tfrac{1}{N}\sum_n \tfrac{p_n^t}{p_n^0}$unweighted
Dutot$P_D = \dfrac{\bar p^t}{\bar p^0}$unweighted
Laspeyres$P_L = \dfrac{\sum_n p_n^t q_n^0}{\sum_n p_n^0 q_n^0}$base quantities
Paasche$P_P = \dfrac{\sum_n p_n^t q_n^t}{\sum_n p_n^0 q_n^t}$current quantities
Fisher$P_F = \sqrt{P_L \cdot P_P}$quantities
Törnqvist$P_T = \exp!\Big(\sum_n \tfrac{1}{2}(s_n^0 + s_n^t)\ln\tfrac{p_n^t}{p_n^0}\Big)$avg. expenditure shares
Walsh$P_W = \dfrac{\sum_n p_n^t \sqrt{q_n^0 q_n^t}}{\sum_n p_n^0 \sqrt{q_n^0 q_n^t}}$geometric-mean quantities

With balanced: false, expenditure shares in the Törnqvist index are re-normalised over the matched products (matched-sample convention).

Multilateral methods ​

Compute a full series with the first chronological period = 1.0.

MethodIdeaQuantity
GEKS-Fisher$P^{\text{GEKS}}t = \prod\Big[\tfrac{P_F(k,t)}{P_F(k,0)}\Big]^{1/T}$ — geometric mean of all Fisher linksrequired
GEKS-Törnqvist (CCDI)same with Törnqvist linksrequired
GEKS-Jevonssame with Jevons links (unweighted)not required
Geary-Khamisiterative solution for reference prices $\alpha_n$ and price levels; maxIter/tol exposedrequired
Time Product DummyWLS regression of $\ln p$ on time and product dummies; weighted toggles expenditure-share weightsrequired when weighted

With balanced: false, GEKS links use the products matched per pair and skip pairs with no common products; Geary-Khamis runs its iteration over observed cells only; Time Product Dummy is row-based and handles unbalanced panels natively.

Data preparation utilities ​

FunctionPurpose
standardizeColumnsselect/rename columns, parse dates, drop zero quantities
aggregateTime(product, period) panel; 6 price aggregation types; quantities summed
removeUnbalancedkeep products present in every period
carryForwardImputationfull product × period grid, last observation carried forward
carryBackwardImputationfull grid, next observation carried backward
getSummaryproducts, date range, quantity presence

Frequencies: 1d, 1w (ISO week, Monday start), 1mo, 1q, 1y — matching Polars' dt.truncate behaviour (verified against generated ground truth).