Learn R Programming

IndexNumR (version 0.6.0)

mixScaleDissimilarity: Computes mix, scale and absolute dissimilarity measures

Description

This is a function to compute the Fox, Hill and Diewert 2004 dissimilarity measures.

Usage

mixScaleDissimilarity(
  x,
  pvar,
  qvar,
  prodID,
  pervar,
  measure = "absolute",
  combine = "geomean"
)

Value

A matrix where the first two columns are the possible combinations of periods and the third column is the dissimilarity measure.

Arguments

x

A dataframe

pvar

string identifying the price variable in x

qvar

string identifying the quantity variable in x

prodID

string identifying the product id variable in x

pervar

string identifying the time period variable in x

measure

choice of dissimilarity measure. Valid options are mix, scale or absolute.

combine

specifies how to combine the price and quantity vectors. "stack" stacks the price and quantity vectors, "geomean" computes separate dissimilarity measures for prices and quantities then takes the geometric mean of these.

References

Fox, K.J., R.J. Hill and W.E. Diewert (2004), "Identifying outliers in multi-output models", Journal of Productivity Analysis, 22, 73-94, 2004.

Examples

Run this code
# estimate the dissimilarity between periods in the CES_sigma_2 dataset
# using the absolute measure of dissimilarity and the geometric mean
# to combine price and quantity information.
mixScaleDissimilarity(CES_sigma_2, pvar = "prices", qvar = "quantities",
pervar = "time", prodID = "prodID", measure = "absolute",
combine = "geomean")

Run the code above in your browser using DataLab