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.
| Method | Formula | Weights |
|---|---|---|
| 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.
| Method | Idea | Quantity |
|---|---|---|
| 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 links | required |
| GEKS-Törnqvist (CCDI) | same with Törnqvist links | required |
| GEKS-Jevons | same with Jevons links (unweighted) | not required |
| Geary-Khamis | iterative solution for reference prices $\alpha_n$ and price levels; maxIter/tol exposed | required |
| Time Product Dummy | WLS regression of $\ln p$ on time and product dummies; weighted toggles expenditure-share weights | required 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
| Function | Purpose |
|---|---|
standardizeColumns | select/rename columns, parse dates, drop zero quantities |
aggregateTime | (product, period) panel; 6 price aggregation types; quantities summed |
removeUnbalanced | keep products present in every period |
carryForwardImputation | full product × period grid, last observation carried forward |
carryBackwardImputation | full grid, next observation carried backward |
getSummary | products, date range, quantity presence |
Frequencies: 1d, 1w (ISO week, Monday start), 1mo, 1q, 1y — matching Polars' dt.truncate behaviour (verified against generated ground truth).