relativeDissimilarity {IndexNumR} | R Documentation |
Computes measures of relative dissimilarity between all periods
Description
A function to compute the relative price dissimilarity between two vectors of prices.
Usage
relativeDissimilarity(
x,
pvar,
qvar,
pervar,
prodID,
indexMethod = "fisher",
similarityMethod = "logquadratic"
)
Arguments
x |
A dataframe containing price, quantities, a time period index and a product identifier. |
pvar |
A string identifying the price variable. |
qvar |
A string identifying the quantity variable. |
pervar |
A string identifying the time index variable. |
prodID |
A string identifying the product ID. |
indexMethod |
A string identifying the index method to use in the calculation. Not relevant for similarityMethod = PLSpread. Supported methods are fisher and tornqvist. Default is Fisher. |
similarityMethod |
A string specifying the formula for calculating the relative dissimilarity. Valid options are logquadratic, asymplinear, PLSpread and predictedshare. Default is logquadratic. |
Value
A matrix of dissimilarity measures. The first two columns are the possible combinations of bilateral comparisons and the third column is the dissimilarity measure.
References
Diewert, W.E. (2002). "Similarity and Dissimilarity Indexes: An Axiomatic Approach" Discussion Paper No. 0210, Department of Economics, University of British Columbia.
Examples
# estimate the dissimilarity between periods in the CES_sigma_2 dataset
# using the log quadratic measure of dissimilarity
relativeDissimilarity(CES_sigma_2, pvar = "prices", qvar="quantities",
pervar = "time", prodID = "prodID", indexMethod="fisher",
similarityMethod = "logquadratic")