chdikhanov: Calculating the monthly chained Dikhanov price index

View source: R/f_chain_indices.R

chdikhanovR Documentation

Calculating the monthly chained Dikhanov price index

Description

This function returns a value (or vector of values) of the monthly chained Dikhanov price index.

Usage

chdikhanov(data, start, end, interval = FALSE)

Arguments

data

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) and prodID (as numeric, factor or character). A column quantities (as positive numeric) is also needed because this function uses unit values as monthly prices.

start

The base period (as character) limited to the year and month, e.g. "2020-03".

end

The research period (as character) limited to the year and month, e.g. "2020-04".

interval

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).

Value

The function returns a value (or vector of values) of the monthly chained Dikhanov 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).

References

Dikhanov, Y., (2024). A New Elementary Index Number. Paper presented at the 18th Meeting of the Ottawa Group on Price Indices, Ottawa, Canada.

Examples

chdikhanov(sugar, start="2018-12", end="2019-04")
chdikhanov(milk, start="2018-12", end="2020-01", interval=TRUE)

JacekBialek/PriceIndices documentation built on Jan. 27, 2025, 6:14 a.m.