Skip to contents

The Laspeyre quantity index is calculated as $$ \frac{\sum_i q^t_i p^b_t}{\sum_i q^b_i p^b_i}.$$ Arguments can either be vectors or matrices.

Usage

q_laspeyre(pb, qt, qb)

Arguments

pb

A n-vector (or m x n matrix) of prices in the baseline period.

qt

A n-vector (or m x n matrix) of quantities in the current period.

qb

A n-vector (or m x n matrix) of quantities in the baseline period.

Value

Price index between current an baseline period (number or vector).

Examples

Pb <- matrix(1:6, ncol = 2)
Qb <- matrix(2:7, ncol = 2)
Qt <- Qb * 1.2
p_laspeyre(Pb, Qt, Qb)
#> [1] 0.6321839 0.6666667 0.6923077
p_laspeyre(Pb[1,], Qt[1,], Qb[1,])
#> [1] 0.6321839