This function returns a value (or values) of the selected final price index for the selected type of aggregation of partial results.
final_index(
data = data.frame(),
start = c(),
end = c(),
formula = c(),
window = c(),
splice = c(),
base = c(),
sigma = c(),
r = c(),
outlets = FALSE,
groups = FALSE,
by = c(),
aggr = "fisher",
interval = FALSE
)
This general function returns a value or values of the selected final price index for the selected type of aggregation of partial results. If the interval
parameter is set to TRUE, then it returns a data frame where its first column indicates dates and the remaining columns show corresponding values of all selected price indices.
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). A column retID
(as numeric, factor or character) is also essential if the aggregation over outlets is considered. A column with grouping variable (as numeric, factor or character - indicated by the by
parameter) is essential if the aggregation over product subgroups is considered.
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 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).
A character string indicating the splicing method (if the multilateral splicing index is selected). Available options are: "movement", "window","half","mean" and their additional variants: "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, AG Mean or GEKS-LM indices (as numeric).
The non-zero parameter used in the quadratic mean of order r quantity / price index or in the GEKS-QM index (as numeric).
A logical parameter indicating whether the aggregation over outlets (defined by retID
column) should be done.
A logical parameter indicating whether the aggregation over product subgroups (indicated by 'by' parameter) should be done.
A character string which indicates a column name for creating product subgroups.
The formula used for aggregating partial index results (available values are: "arithmetic", "geometric", "laspeyres", "paasche", "fisher", "tornqvist").
A logical value indicating whether the function is to provide price indices 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
).
final_index(coffee, start = "2018-12", end = "2019-12",
formula = "fisher", groups = TRUE, outlets = FALSE,
aggr = "tornqvist", by = "description")
final_index(milk, start = "2018-12", end = "2019-12",
formula = "fisher", groups = TRUE, outlets = TRUE,
aggr = "laspeyres", by = "description",
interval = TRUE)
Run the code above in your browser using DataLab