dissimilarity_fig: Presenting the relative price and/or quantity dissimilarity...

dissimilarity_figR Documentation

Presenting the relative price and/or quantity dissimilarity measure over time

Description

This function presents values of the relative price and/or quantity dissimilarity measure over time.

Usage

dissimilarity_fig(
  data,
  start,
  end,
  type = "p",
  benchmark = "end",
  figure = TRUE,
  date_breaks = "1 month"
)

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), quantities (as positive numeric) and prodID (as numeric, factor or character).

start

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

end

The research period (as character) limited to the year and month, e.g. '2019-07'.

type

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

benchmark

The benchmark period (as character) limited to the year and month, e.g. '2019-07'.

figure

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.

date_breaks

A string giving the distance between breaks on the X axis like "1 month" (default value) or "4 months".

Value

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

References

Diewert, E. (2020). The Chain Drift Problem and Multilateral Indexes. Chapter 6 in: Consumer Price Index Theory (draft)

Examples

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

PriceIndices documentation built on July 9, 2023, 6:20 p.m.