This function returns a value or values of the selected (final) price index taking into consideration aggregation over product subgroups and/or over outlets. Optionally, the function returns a data frame or a figure presenting calculated indices, i.e. the price index for the whole data set and price indices for product subgroups.
final_index2(
data = data.frame(),
by,
all = FALSE,
start,
end,
formula = "fisher",
window = 13,
splice = "movement",
base = start,
sigma = 0.7,
aggrret = "tornqvist",
aggrsets = "tornqvist",
interval = FALSE,
figure = FALSE,
date_breaks = "1 month"
)
This function returns a value or values of the selected (final) price index taking into consideration aggregation over product subgroups and/or over outlets (retailer sale points defined in retID
column). Optionally, the function returns a data frame or a figure presenting calculated indices, i.e. the price index for the whole data set and price indices for product subgroups.To be more precise: if both types of aggregation are selected, then for each subgroup of products and for each outlet (point of sale) price indices are calculated separately and then aggregated (according to the aggregation methods indicated) to the form of the final price index. If the interval
parameter is set to TRUE then it returns a data frame (or a figure) with dates and final index values (after optional aggregating). Please note that different index formulas may use different time intervals (or time periods) for calculations and each time, aggregation over outlets is done for the set of retIDs being available during the whole considered time interval.
The user's data frame with subgroups of sold products (see by
parameter). Each data frame must contain columns: time
(as Date in format: year-month-day,e.g. '2020-12-01'), prices
(as positive numeric), quantities
(as positive numeric), prodID
(as numeric, factor or character) and retID
(as numeric, factor or character). An additional column indicated via by
parameter is also needed.
The column name indicating grouping variable, i.e. this column is used for creating subgroups of products.
A logical value indicating whether the the selected price index is to be calculated only for the whole set of products or also for created subgroups of products (then all
is set to TRUE).
The base period (as character) limited to the year and month, e.g. "2019-12".
The research period (as character) limited to the year and month, e.g. "2020-04".
The character string indicating the (final or main) price index formula is to be calculated. To see available options please use the link: PriceIndices
.
The length of the time window if the multilateral index is selected (as positive integer: typically multilateral methods are based on the 13-month time window and thus the default value is 13).
A character string indicating the splicing method (if the multilateral splicing index is selected). Available options are: "movement", "window","half", "mean" and also "window_published", "half_published" and "mean_published".
The prior period used in the Young- or Lowe-type price indices (as character) limited to the year and month, e.g. "2020-01".
The elasticity of substitution parameter used in the Lloyed-Moulton and AG Mean indices (as numeric).
A character string indicating the formula for aggregation over outlets (retailer sale points). Available options are: "none", "laspeyres", "paasche", "geolaspeyres", "geopaasche", "fisher", "tornqvist", "arithmetic" and "geometric". The first option means that there is no aggregating over outlets. The last two options mean unweighted methods of aggregating, i.e. the arithmetic or geometric mean is used.
A character string indicating the formula for aggregation over product subgroups. Available options are: "none", "laspeyres", "paasche", "geolaspeyres", "geopaasche", "fisher", "tornqvist", "arithmetic" and "geometric". The first option means that there is no aggregating over product subgroups. The last two options mean unweighted methods of aggregating, i.e. the arithmetic or geometric mean is used.
A logical value indicating whether the function is to provide the price index comparing 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 presented (the fixed base month is defined by start
).
A logical value indicating whether the function returns a figure presenting all calculated indices (it works if all
and interval
are set to TRUE)
A string giving the distance between breaks on the X axis like "1 month" (default value) or "4 months".
final_index2(data=coffee, by="description",all=TRUE,start="2018-12",end="2019-12",
formula="fisher",interval=TRUE,aggrsets="laspeyres",aggrret="none",figure=FALSE)
final_index2(data=coffee, by="retID",all=TRUE,start="2018-12",end="2019-12",
formula="fisher",interval=TRUE,aggrsets="none",aggrret="none",figure=TRUE)
Run the code above in your browser using DataLab