geks | R Documentation |
Calculate an inter-temporal GEKS price index over a rolling window, as described in chapter 7 of Balk (2008), by Ivancic et al. (2011), and in chapter 10 of the CPI manual (2020).
geks(f)
tornqvist_geks(
p,
q,
period,
product,
window = nlevels(period),
n = window - 1L,
na.rm = FALSE
)
fisher_geks(
p,
q,
period,
product,
window = nlevels(period),
n = window - 1L,
na.rm = FALSE
)
walsh_geks(
p,
q,
period,
product,
window = nlevels(period),
n = window - 1L,
na.rm = FALSE
)
f |
A price index function that uses information on both base and current-period prices and quantities, and satisfies the time-reversal test. Usually a Törnqvist, Fisher, or Walsh index. |
p |
A numeric vector of prices, the same length as |
q |
A numeric vector of quantities, the same length as |
period |
A factor, or something that can be coerced into one, that
gives the corresponding time period for each element in |
product |
A factor, or something that can be coerced into one, that
gives the corresponding product identifier for each element in |
window |
A positive integer giving the length of the rolling window.
The default is a window that encompasses all periods in |
n |
A positive integer giving the length of the index series for each
window, starting from the end of the window. For example, if there are 13
periods in |
na.rm |
Passed to |
geks()
returns a function:
function(p, q, period, product, window = nlevels(period), n = window - 1, na.rm = FALSE){...}
This calculates a period-over-period GEKS index with the desired index-number formula, returning a list for each window with a named-numeric vector of index values.
tornqvist_geks()
, fisher_geks()
, and walsh_geks()
each return a list
with a named numeric vector giving the value of the respective
period-over-period GEKS index for each window.
Like back_period()
, if multiple prices
correspond to a period-product pair, then the back price at a point in time
is always the first price for that product in the previous period. Unlike a
bilateral index, however, duplicated period-product pairs can have more
subtle implications for a multilateral index.
Balk, B. M. (2008). Price and Quantity Index Numbers. Cambridge University Press.
ILO, IMF, OECD, Eurostat, UN, and World Bank. (2020). Consumer Price Index Manual: Theory and Practice. International Monetary Fund.
Ivancic, L., Diewert, W. E., and Fox, K. J. (2011). Scanner data, time aggregation and the construction of price indexes. Journal of Econometrics, 161(1): 24–35.
GEKSIndex()
in the indexNumR package for an implementation of the
GEKS index with more options.
Other price-indexes:
index_weights()
,
price_indexes
price <- 1:6
quantity <- 6:1
period <- rep(1:3, 2)
product <- rep(letters[1:2], each = 3)
tornqvist_geks(price, quantity, period, product)
tornqvist_geks(price, quantity, period, product, window = 2)
# Missing data
quantity[2] <- NA
# Use all non-missing data
fisher_geks(price, quantity, period, product, na.rm = TRUE)
# Remove records with any missing data
fg <- geks(balanced(fisher_index))
fg(price, quantity, period, product, na.rm = TRUE)
# Make a Jevons GEKS index
jevons_geks <- geks(\(p1, p0, ..., na.rm) jevons_index(p1, p0, na.rm))
jevons_geks(price, quantity, period, product)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.