This function returns a value (or vector of values) of the monthly chained AG Mean price index.
chagmean(data, start, end, sigma = 0.7, interval = FALSE)
The function returns a value (or vector of values) of the monthly chained AG Mean price index depending on the interval
parameter. If the interval
parameter is set to TRUE, the function returns a vector of price index values without dates. To get information about both price index values and corresponding dates, please see functions: price_indices
or final_index
. The function does not take into account aggregating over outlets or product subgroups (to consider these types of aggregating, please use the final_index
function).
The user's data frame with information about sold products. It must contain columns: time
(as Date in format: year-month-day,e.g. '2020-12-01'), prices
(as positive numeric), quantities
(as positive numeric) and prodID
(as numeric, factor or character).
The base period (as character) limited to the year and month, e.g. "2020-03".
The research period (as character) limited to the year and month, e.g. "2020-04".
The elasticity of substitution parameter (as numeric).
A logical value indicating whether the function is to compare the research period defined by end
to the base period defined by start
(then interval
is set to FALSE) or all fixed base indices are to be calculated. In this latter case, all months from the time interval <start,end>
are considered and start
defines the base period (interval
is set to TRUE).
Lent J., & Dorfman,A. H. (2009). Using a Weighted Average of Base Period Price Indexes to Approximate a Superlative Index. Journal of Official Statistics, 25(1), 139-149.
chagmean(sugar, start="2019-01", end="2019-04",sigma=0.5)
chagmean(milk, start="2018-12", end="2020-01", interval=TRUE)
Run the code above in your browser using DataLab