Learn R Programming

revealedPrefs (version 0.4.1)

directPrefs: Compute direct and indirect revealed preferences.

Description

The directPrefs function computes direct revealed preferences, the indirectPrefs function computes indirect revealed preferences.

Usage

directPrefs(x, p, afriat.par= 1)
indirectPrefs(x, p, afriat.par= 1)

Arguments

x

data frame or matrix containing the observed quantities, where each row corresponds to an observation and the columns are types of goods.

p

data frame or matrix (of same dimensions as x) containing the corresponding prices.

afriat.par

the Afriat parameter, real number in [0,1], which allows a certain level of error in the optimization of choices; default is 1, ie. no optimization error allowed.

Value

A matrix of direct or indirect revealed preferences:

prefs[i, j] = 0

if bundle i is not revealed prefered to bundle j

prefs[i, j] = 1

if bundle i is revealed prefered to bundle j

prefs[i, j] = 2

if bundle i is strictly revealed prefered to bundle j

Details

Direct preferences are directly computed from matrix multiplication of prices and quantities. Indirect preferences are computed using a variant of the Floyd-Warshall algorithm.

References

Varian, H. R. (1984) Microeconomic Analysis. New York/London: Norton, 2nd edition, pp 141-143.

Examples

Run this code
# NOT RUN {
# Compute direct and indirect preferences of SARP-violating data:
data(noSarp)
directPrefs(noSarp$x, noSarp$p)
indirectPrefs(noSarp$x, noSarp$p)
# }

Run the code above in your browser using DataLab