mixScaleDissimilarity: Computes mix, scale and absolute dissimilarity measures

View source: R/dissimilarity.R

mixScaleDissimilarityR Documentation

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

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.

Value

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

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

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

IndexNumR documentation built on Nov. 11, 2023, 1:07 a.m.