View source: R/dissimilarity.R
relativeDissimilarity | R Documentation |
A function to compute the relative price dissimilarity between two vectors of prices.
relativeDissimilarity(
x,
pvar,
qvar,
pervar,
prodID,
indexMethod = "fisher",
similarityMethod = "logquadratic"
)
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. |
A matrix of dissimilarity measures. The first two columns are the possible combinations of bilateral comparisons and the third column is the dissimilarity measure.
Diewert, W.E. (2002). "Similarity and Dissimilarity Indexes: An Axiomatic Approach" Discussion Paper No. 0210, Department of Economics, University of British Columbia.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.