checkGarp {revealedPrefs} | R Documentation |
Non-parametric tests of rationality axioms (WARP, SARP, GARP).
Description
Functions for non-parametric tests of compliance with rationality axioms.
Functions checkWarp
, checkSarp
and checkGarp
perform exact tests of the Weak Axiom of Revealed Preferences (WARP), the Strong Axiom of Revealed Preferences (SARP) and the Generalized Axiom of Revealed Preferences (GARP) respectively, to check whether the given data are consistent with utility maximization.
Usage
checkWarp(x, p, afriat.par= 1)
checkSarp(x, p, afriat.par= 1, method= c("deep", "floyd"))
checkGarp(x, p, afriat.par= 1, method= c("floyd"))
## S3 method for class 'axiomTest'
print(x, ...)
## S3 method for class 'axiomTest'
summary(object, ...)
Arguments
x |
data frame or matrix containing the observed quantities, where each row corresponds to an observation and the columns are types of goods, or an object of class |
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, |
method |
character string: |
object |
an object of class |
... |
additional arguments passed to the |
Details
Rationality axioms can be summarized as follows:
WARP: if X directly prefered to Y and X is not equal to Y, then Y cannot be directly prefered to X (WARP is a necessary condition for the existence of a single-valued utility-maximizing demand function consistent with the data).
SARP: if X (in)directly prefered to Y and X is not equal to Y, then Y cannot be (in)directly prefered to X (SARP is a necessary and sufficient condition for the existence of a single-valued utility-maximizing demand function consistent with the data).
GARP: if X (in)directly prefered to Y, then Y cannot be strictly directly prefered to X (GARP is a necessary and sufficient condition for the existence of a (possibly multiple-valued) utility-maximizing demand function consistent with the data).
If WARP or GARP are violated, then SARP is also violated.
Testing of WARP is straightforward by pairwise comparison of revealed preferences. GARP is tested using the Floyd-Warshall algorithm to find the transitive closure of the direct preference relationship. SARP can be tested either using the Floyd-Warshall algorithm, or using a depth-first search that systematically explores the preference relationship in search of a violating cycle.
Value
Functions checkWarp
, checkSarp
and checkGarp
return an object of class axiomTest
which may contain the following elements:
violation |
logical value, |
path |
last path taken during depth-first search, |
path.strict |
(for |
violators |
vector of indices of axiom-violating observations (only the first violators that were found are reported, this is not a complete list), |
strict |
vector of logical values indicating whether the preferences between reported violators (or path) are strict or not, |
direct.violation |
logical value, |
type |
the violated or non-violated rationality axiom, |
method |
method used for the non-parametric test, |
afriat.par |
Afriat parameter used in the algorithm. |
Author(s)
Julien Boelaert jubo.stats@gmail.com
References
Varian, H. R. (1982) The Nonparametric Approach to Demand Analysis, Econometrica, 50(4):945-973.
Varian, H. R. (1984) Microeconomic Analysis. New York/London: Norton, 2nd edition, pp 141-143.
Examples
# Check axioms for GARP-violating data:
data(noGarp)
summary(checkGarp(noGarp$x, noGarp$p))
# Check axioms for SARP-consistent data:
data(okSarp)
summary(checkSarp(okSarp$x, okSarp$p))