dissimilarity: Calculating the relative price and/or quantity dissimilarity...

dissimilarityR Documentation

Calculating the relative price and/or quantity dissimilarity measure between periods

Description

This function returns a value of the relative price and/or quantity dissimilarity measure.

Usage

dissimilarity(data, period1, period2, type = "p")

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

period1

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

period2

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

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

Value

This function returns a value of the relative price (dSP) and/or quantity (dSQ) dissimilarity measure. In a special case, when the type parameter is set to pq, the function provides the value of dSPQ measure (the relative price and quantity dissimilarity measure calculated as min(dSP,dSQ).

References

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

Examples

dissimilarity(milk, period1="2018-12",period2="2019-12",type="q")
dissimilarity(milk, period1="2018-12",period2="2019-12",type="pq")

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