price <- 1:10
quantity <- 10:1
period <- rep(1:5, 2)
product <- rep(letters[1:2], each = 5)
cumprod(geks_index(price, quantity, period, product)[[1]])
# Calculate the index over a rolling window.
(geks <- geks_index(price, quantity, period, product, window = 3))
# Use a movement splice to combine the indexes in each window.
splice_index(geks, 2)
# ... or use a mean splice.
splice_index(geks)
# Make a Jevons GEKS index.
geks_index(
price,
quantity,
period,
product,
index_formula = \(p1, p0, ...) gmean(p1 / p0, na.rm = TRUE, order = 0)
)
Run the code above in your browser using DataLab