quantity_index: Quantity indexes

Description Usage Arguments Value See Also Examples

View source: R/4_quantity_index.R

Description

It is trivial to turn a price index into a quantity index by switching the role of prices and quantities in the index-number formula. This function does just that.

Usage

1

Arguments

price_index

A function to compute a price index. See price_index.

Value

A function like price_index, except that the role of prices/quantities has been reversed.

See Also

price_index for the possible functions that can serve as inputs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Make some data

p0 <- price6[[2]]
q1 <- quantity6[[3]]
q0 <- quantity6[[2]]

# Just remaps argument names to be quantities rather than prices

quantity_index(index_laspeyres)(q1 = q1, q0 = q0, p0 = p0)

index_laspeyres(p1 = q1, p0 = q0, q0 = p0)

# Works with the index_weights() functions, too

quantity_index(index_weights("Laspeyres"))(q0 = q0, p0 = p0)

gpindex documentation built on Feb. 3, 2021, 1:06 a.m.