checkGarp: Non-parametric tests of rationality axioms (WARP, SARP,...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/axioms.R

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

1
2
3
4
5
6
7
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 axiomTest for use with print,

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: "deep" for depth-first search (default for Sarp), "floyd" for Floyd-Warshall algorithm (can be very slow for large datasets when no violations are present),

object

an object of class axiomTest as returned by eg. checkWarp,

...

additional arguments passed to the print and summary methods (unused).

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, TRUE if a violation was found,

path

last path taken during depth-first search,

path.strict

(for deep method) vector of logical values indicating the strictness of direct preference relations in the last path taken,

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, TRUE if a violation was found in direct preferences,

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

1
2
3
4
5
6
7
# 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))

Example output

  GARP rationality test: violation found.
  Method: Depth-first search with tabu list.
  Afriat parameter: 1 (no optimization error allowed)

  Violating observations: 1 > 2 > 3 > 1 
                        : (direct preferences)

  Other axioms:
  * WARP      : unknown (equality of quantities not tested).
  * SARP      : violated (symmetry of indirect preferences, unequal quantities).


  SARP rationality test: no violation.
  Method: Depth-first search with tabu list.
  Afriat parameter: 
  Other axioms:
  * WARP      : not violated.
  * GARP      : unknown (strict preferences not computed).

revealedPrefs documentation built on Sept. 5, 2019, 9:04 a.m.