directPrefs {revealedPrefs} | R Documentation |
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. |
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.
Value
A matrix of direct or indirect revealed preferences:
prefs[i , j] = 0 |
if bundle |
prefs[i , j] = 1 |
if bundle |
prefs[i , j] = 2 |
if bundle |
Author(s)
Julien Boelaert jubo.stats@gmail.com
References
Varian, H. R. (1984) Microeconomic Analysis. New York/London: Norton, 2nd edition, pp 141-143.
Examples
# Compute direct and indirect preferences of SARP-violating data:
data(noSarp)
directPrefs(noSarp$x, noSarp$p)
indirectPrefs(noSarp$x, noSarp$p)