This function presents values of the relative price and/or quantity dissimilarity measure over time.
dissimilarity_fig(
data,
start,
end,
type = "p",
benchmark = "end",
figure = TRUE,
date_breaks = "1 month"
)
This function presents values of the relative price and/or quantity dissimilarity measure over time. The user can choose a benchmark period (defined by benchmark
) and the type of dissimilarity measure is to be calculated (defined by type
). The obtained results of dissimilarities over time can be presented in a dataframe form or via a figure (the default value of figure
is TRUE, which results in a figure).
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. '2019-03'.
The research period (as character) limited to the year and month, e.g. '2019-07'.
The parameter indicates what type of dissimilarity measure is to be calculated. Possible values of the type
parameter are: p
(for the price dissimilarity measure calculation), q
(for the quantity dissimilarity measure calculation) or pq
(for the dSPQ measure calculation, i.e. the measure of relative price and quantity dissimilarity - see References
).
The benchmark period (as character) limited to the year and month, e.g. '2019-07'.
A logical parameter indicating the resulting object. If it is TRUE, the function presents the above-mentioned dissimilarities over time via a figure. Otherwise, the function returns a dataframe.
A string giving the distance between breaks on the X axis like "1 month" (default value) or "4 months".
Diewert, E. (2020). The Chain Drift Problem and Multilateral Indexes. Chapter 6 in: Consumer Price Index Theory (draft)
dissimilarity_fig(milk, start="2018-12",end="2019-12",type="q",figure=FALSE)
dissimilarity_fig(milk, start="2018-12",end="2019-12",type="pq",benchmark="start")
Run the code above in your browser using DataLab