Description Usage Arguments Value References See Also Examples
Calculate an inter-temporal GEKS price index, as described in chapter 7 of Balk (2008) and by Ivancic et al. (2011).
1 2 3 4 5 6 7 |
f |
A |
price, quantity |
A numeric vector of prices/quantities. |
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 |
The length of the window. The default is a window that encompasses all periods in
|
n |
A number giving the length of the index series for each window. For example, if there are 13 periods in |
na.rm |
Should missing values for |
geks()
returns a function to calculate a GEKS index with the desired index-number formula.
tornqvist_geks()
and fisher_geks()
both return a list with a named numeric vector giving the value of the respective period-over-period GEKS index for each window.
Balk, B. M. (2008). Price and Quantity Index Numbers. Cambridge University Press.
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.
price_index
for price-index functions that can be used in geks()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.