q_laspeyre: Laspeyre quantity index.

View source: R/building_blocks.R

q_laspeyreR Documentation

Laspeyre quantity index.

Description

The Laspeyre quantity index is calculated as

\frac{∑_i q^t_i p^b_t}{∑_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)
p_laspeyre(Pb[1,], Qt[1,], Qb[1,])

ErikOSorensen/pppindexr documentation built on Jan. 7, 2023, 4:11 p.m.