*! version 2.00 31january2022

Title

aei--Testing Axioms of Revealed Preference

Syntax

aei,
price(mname) quantity(mname) [ options]

options

axiom(aei##options:axiom) axiom for testing data; default is axiom(eGARP).
In total, there are six axioms that can be tested: eGARP, eSGARP, eWARP, eWGARP, eSARP, eHARP and eCM.

tolerance(aei##options:tolerance) tolerance level in termination criterion 10^-2n}; default is tolerance(6).

Description

aei calculates measures of goodness-of-fit when the data violates the revealed preference axiom.

aei is the second in a series of three commands for testing axioms of revealed preference.
The other two commands are checkax (which tests whether consumer demand data satisfy certain revealede preference axioms at a given efficiency level) and powerps (which
calculates the power against uniform random behavior and predictive success for the axioms at any given efficienecy level).

aei is dependent on checkax.

For further details on the commands, please see Demetry, Hjertstrand and Polisson (2020) "Testing Axioms of Revealed Preference in Stata". IFN Working Paper No. 1342.

Options

axiom specifies which axiom the user would like to use in testing the data for consistency. The default is axiom(eGARP).
In total, there are six axioms that can be tested: eGARP, eWARP, eWGARP, eSARP, eHARP and eCM. Axiom(all) uses all six axioms.

tolerance sets the tolerance level in the termination criterion 10^-n by specifying the integer number n.
For example, tolerance(10) sets the tolerance level in the termination criterion to 10^-10. The default is
tolerance(6), which gives the default tolerance level 10^-6. The integer n in the termination criterion 10^-n
cannot be smaller than 1 or larger than 18.

Stored results

aei stores the following in r(). Notice that results are suffixed by the axiom being tested except for results that apply to all axioms, i.e. number of goods and observations, and tolerance level.

Scalars

r(AEI_axiom) AEI for the axiom being tested

r(TOL) tolerance level for termination criterion

r(GOODS) number of goods in the data

r(OBS) number of observations in the data

Macros

r(AXIOM) axiom(s) being tested

Examples: Loading data and running the command

Install package

. ssc install rpaxioms

Download example data (from ancillary files)

Note: the downloaded file is in your current working directory

. net get rpaxioms

Load example data

. use rpaxioms_example_data.dta, clear

In the example dataset provided, we have 20 observations of the prices and quantities of five goods.
These have variable names p1, ..., p5 for prices, and x1, ..., x5 for quantities.

In order to use the command, we need to create a matrix for prices
(where each column is a good and each row is an observation).
Likewise, we need to create a matrix for quantities.

Make matrices P and X from variables

. mkmat p1-p5, matrix(P)

. mkmat x1-x5, matrix(X)

We now have two 20x5 matrices; one for prices and one for quantities.

. matlist P

. matlist X

Run command with default settings

. aei, price(P) quantity(X)

Run command with eGarp and eHARP, at tolerance level 10^-8

. aei, price(P) quantity(X) ax(eGARP eHARP) tol(8)

Run command with all axioms, at tolerance level 10^-8

. aei, price(P) quantity(X) ax(all) tol(8)

Examples: Interpreting the results

Running the last line above produces the following results:

Number of obs = 20
Number of goods = 5
Tolerance level = 1.0e-08

-------------------------
Axiom | AEI
-------------+-----------
eGARP | .9055851
eSGARP | .7672872
eWGARP | .9055851
eSARP | .9055851
eWARP | .9055851
eHARP | .8449687
eCM | .8473896
-------------------------

Regardless of which (or how many) axiom(s) are tested, in your results window you will always
see the number of observations and goods as well as the tolerance level in the top-right corner.

In the table, you will find two columns - Axiom and AEI.
The column Axiom specifies which axioms are being tested.
The column AEI specifies the efficiency level at which the data would satisfy respective axiom.

The AEI gives the largest efficiency level such that the data satisfies a certain revealed preference axiom.
Looking, for instance, at eGARP, the results indicate that the consumer can obtain the same level of utility
by spending approximately 10% less of her budget. Alternatively, looking at eCM, these results says that the
consumer can obtain the same level of quasilinear utility by spending approximately 15% less of her budget. If
these numbers are small or large is subjective. The literature has suggested cut-off levels at 80% up to 95%,
but it has also been argued that this level should depend on the problem at hand, that is, the number of
observations, the power of the test, and the model (axiom) under consideration. Therefore, we encourage users
to decide for themselves whether they consider a reported efficiency level to be small or large.

Speed tests

Using the example dataset provided with the package, 100 iterations of
aei, price(P) quantity(X) axiom(eGARP) yields the following
average execution time in seconds (per tolerance level).

--------------------------------------------
Tolerance | Seconds | Seconds (M1 Pro)
----------+------------+--------------------
1 | .02862 | .02066
2 | .04477 | .03477
3 | .06498 | .04557
4 | .07968 | .05636
5 | .09584 | .06917
6 | .13889 | .08139
7 | .13237 | .09679
8 | .14709 | .10281
9 | .1907 | .11897
10 | .18423 | .13022
11 | .21832 | .14077
12 | .22341 | .15464
13 | .25624 | .16714
14 | .25038 | .18041
15 | .28749 | .1889
----------+------------+--------------------

The first speed test was performed on a MacBook Pro 15-inch, 2018 with a 2,6GHz 6-Core Intel Core i7
running on macOS Catalina version 10.15.4, and Stata/MP version 15.1.

The second speed test was performed on a Macbook Pro 16-inch, 2021 with 32GB memory and an Apple M1 Pro chip
running on macOS Monterey version 12.2.1, and Stata/MP version 17.0.

Authors

- Marcos Demetry, PhD student at Linnaeus University, Sweden, and affiliated doctoral student at
the Research Institute of Industrial Economics, Sweden.
- Per Hjertstrand, Associate Professor and Research Fellow at the Research Institute
of Industrial Economics, Sweden.
- Matthew Polisson, Senior Lecturer and Researcher at University of Bristol, UK.