*! version 1.00 23november2020

Title

powerps--Testing Axioms of Revealed Preference

Syntax

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

options

axiom(powerps##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.
To test all axioms at once, specify axiom(all).

efficiency(powerps##options:efficiency) efficiency level for testing data, where 0 < efficiency =< 1; default is efficiency(1).

simulations(powerps##options:simulations) number of repititions of the simulated uniformly random data; default is simulations(1000).

seed(powerps##options:seed) seed in generation of Dirichlet random numbers; default is seed(12345).

aei(powerps##options:aei) compute AEI for each simulated uniformly random data set and every specified axiom; default is aei not specifiede.

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

progressbar(powerps##options:progress) displays number of repititions that have been executed; default is progressbar not specified.

Description

powerps calculates the power against uniform random behavior and predictive success for the axioms at any given efficiency level.

powerps is the third 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
aei (which calculates measures of goodness-of-fit wheen the data violates the axioms).

powerps is dependent on checkax and aei.

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. To test all axioms at once, specify axiom(all).

efficiency specifies the efficiency
level at which the user would like to test the data. The default efficiency level is efficiency(1).
Efficiency must be greater than zero and less than or equal to one.

simulations specifies the number of repititions of the simulated uniformly random data; default is simulations(1000).

seed specifies the random seed in generation of Dirichlet random numbers; default is seed(12345).

aei specifies whether the user wants to compute the AEI for each simulated uniformly random data set and every specified axiom;
default is aei not specified.

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.

progressbar displays number of repititions that have been executed. The default is progressbar not specified.

Stored results

powerps 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, as well as efficiency and tolerance levels.

Scalars

r(POWER_axiom) computed power for each axiom

r(PS_axiom) computed predictive success for each axiom

r(PASS_axiom) indicator for whether data pass the axiom or not

r(AEI_axiom) AEI for the axiom being tested

r(SIM) number of repeitions in the simulatede uniformly random data

r(TOL) tolerance level for termination criterion, if option aei is specified

r(EFF) efficiency level at which the axiom is tested

r(GOODS) number of goods in the data

r(OBS) number of observations in the data

Macros

r(AXIOM) axiom(s) being tested

Matrices

r(SUMSTATS_axiom) summary statistics for random data: Num_vio, Frac_Vio (and aei if specified).

r(SIMRESULTS_axiom) Num_vio, Frac_Vio (and aei if specified) for every simulated uniformly random data set.

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

. powerps, price(P) quantity(X)

This has an approximate runtime of six seconds.

Run command with eGARP and eHARP

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

Note that running this command may take up to five minutes.
This is mainly due to including the option aei.

Examples: Interpreting the results

Number of obs = 20
Number of goods = 5
Simulations = 1000
Efficiency level = 1

----------------------------------------------------------
Axioms | Power PS Pass AEI
-------------+--------------------------------------------
eGARP | .995 -.005 0 .9055848
eHARP | 1 0 0 .8449683
----------------------------------------------------------

Summary statistics for simulations:

-----------------------------------------------
eGARP | #vio %vio AEI
-------------+---------------------------------
Mean | 47.339 .1245762 .842074
Std. Dev. | 29.45589 .0775135 .0814885
Min | 0 0 .5616641
Q1 | 24 .0632 .7924724
Median | 45 .1184 .8516641
Q3 | 68.5 .18025 .9015746
Max | 143 .3763 1
-----------------------------------------------

-----------------------------------------------
eHARP | #vio %vio AEI
-------------+---------------------------------
Mean | 20 1 .7268926
Std. Dev. | 0 0 .0760639
Min | 20 1 .4819741
Q1 | 20 1 .6767941
Median | 20 1 .7307339
Q3 | 20 1 .7845821
Max | 20 1 .8955998
-----------------------------------------------

These results indicate that GARP at an efficiency level of 1 has power against uniformly random
behavior equal to 99.5%. This means that the GARP test has enough empirical bite to reject the
notion of uniformly random behavior would the ‘true’ consumer behavior be generated as such.
Since GARP is necessary for HARP, the latter will always have higher power. The predictive
success (PS) suggests that HARP marginally dominates GARP as a measure of model fit, i.e.,
the homothetic utility maximization model weakly dominates the standard utility
maximization model for these data.

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.