With thanks to Kit Baum, the module rpaxioms containing the three commands checkax, aei and powerps, is now available from SSC.
Use
to install the module containing the three commands.
checkax allows the user to test whether consumer demand data satisfy certain revealed preference axioms at a given efficiency level. The second command, aei, calculates measures of goodness-of-fit when the data violates the axioms. The third and final command, powerps, calculates the power against uniform random behaviour and predictive success for the axioms at any given efficiency level.
For further information, please refer to Demetry, Hjertstrand and Polisson (2020) "Testing Axioms of Revealed Preference", IFN Working Paper Nr 1342 ; as well as the help files of respective commands.
For illustration, we use made up price and quantity data; matrices P and X below.
The first command, checkax, works as follows: with the price and quantity matrices as inputs, the command checks whether the data satisfy the chosen axiom of revealed preference (in this case, no axiom was specified, and therefore eGARP was chosen per default) at the given efficiency level eff (also set to 1 per default if not otherwise specified).
The code below illustrates checkax with non-default settings.
Similarly, aei uses the price and quantity matrices and shows at which efficiency level the data would pass the specified axiom.
And here is an example of aei with non-default settings:
Lastly, here is an illustration of powerps with default settings...
As opposed to the previous two commands, powerps can take several axioms in the axiom() option, as illustrated below:
Use
Code:
ssc install rpaxioms
checkax allows the user to test whether consumer demand data satisfy certain revealed preference axioms at a given efficiency level. The second command, aei, calculates measures of goodness-of-fit when the data violates the axioms. The third and final command, powerps, calculates the power against uniform random behaviour and predictive success for the axioms at any given efficiency level.
For further information, please refer to Demetry, Hjertstrand and Polisson (2020) "Testing Axioms of Revealed Preference", IFN Working Paper Nr 1342 ; as well as the help files of respective commands.
For illustration, we use made up price and quantity data; matrices P and X below.
Code:
clear input A B C D E F G H I J 8 2 1 6 9 27 22 29 28 43 4 4 5 6 5 44 33 38 27 37 6 6 9 8 2 22 25 48 27 43 6 5 7 1 5 32 20 48 24 40 2 1 6 7 4 20 49 38 49 23 6 3 9 6 5 26 33 30 49 35 7 9 1 2 9 20 49 46 45 30 5 1 10 10 5 25 43 33 42 22 9 9 2 6 4 24 20 48 25 24 8 1 6 5 4 28 41 21 31 26 4 7 2 10 2 25 41 36 25 40 5 6 6 7 3 24 39 42 20 33 4 3 1 5 1 38 37 25 29 41 8 6 8 9 5 47 26 30 41 27 8 2 9 6 3 49 43 25 39 20 5 7 10 6 3 26 27 29 36 36 7 6 10 7 5 34 31 32 33 28 10 1 6 4 2 31 47 37 28 49 8 1 3 3 5 36 46 21 35 48 8 2 2 6 8 28 32 37 43 32 end mkmat A B C D E, matrix(P) mkmat F G H I J, matrix(X)
The first command, checkax, works as follows: with the price and quantity matrices as inputs, the command checks whether the data satisfy the chosen axiom of revealed preference (in this case, no axiom was specified, and therefore eGARP was chosen per default) at the given efficiency level eff (also set to 1 per default if not otherwise specified).
Code:
. checkax, price(P) quantity(X) --------------------------------------------------------------------------------- Axiom | Pass #vio %vio Goods Obs Eff -------------+------------------------------------------------------------------- eGARP | 0 136 35.79 5 20 1.00 --------------------------------------------------------------------------------- . . return list scalars: r(PASS) = 0 r(NUM_VIO) = 136 r(FRAC_VIO) = 35.79 r(GOODS) = 5 r(OBS) = 20 r(EFF) = 1 macros: r(AXIOM) : "eGARP"
Code:
. checkax, price(P) quantity(X) axiom(eHARP) efficiency(0.95) --------------------------------------------------------------------------------- Axiom | Pass #vio %vio Goods Obs Eff -------------+------------------------------------------------------------------- eHARP | 0 20 100.00 5 20 0.95 ---------------------------------------------------------------------------------
Similarly, aei uses the price and quantity matrices and shows at which efficiency level the data would pass the specified axiom.
Code:
. aei, price(P) quantity(X) ---------------------------------------------------------- Axiom | AEI Tol Goods Obs -------------+-------------------------------------------- eGARP | .9056 1.00e-12 5 20 ---------------------------------------------------------- . return list scalars: r(AEI) = .9055851063826594 r(TOL) = 1.00000000000e-12 r(GOODS) = 5 r(OBS) = 20 macros: r(AXIOM) : "eGARP"
Code:
. aei, price(P) quantity(X) axiom(eWGARP) tol(6) ---------------------------------------------------------- Axiom | AEI Tol Goods Obs -------------+-------------------------------------------- eWGARP | .9056 1.00e-06 5 20 ----------------------------------------------------------
Lastly, here is an illustration of powerps with default settings...
Code:
. powerps, price(P) quantity(X) ------------------------------------------------------------------------------------------------------ Axioms | Power PS Pass AEI Sim Eff Goods Obs -------------+---------------------------------------------------------------------------------------- eGARP | .995 -.005 0 .9055851 1000 1 5 20 ------------------------------------------------------------------------------------------------------ Summary statistics for simulations: ------------------------------------ eGARP | #vio %vio -------------+---------------------- Mean | 39.497 10.39415 Std. Dev. | 25.68762 6.759885 Min | 0 0 Q1 | 18 4.74 Median | 37 9.74 Q3 | 59 15.53 Max | 120 31.58 ------------------------------------ . . return list scalars: r(POWER_egarp) = .995 r(PS_egarp) = -.005 r(PASS_egarp) = 0 r(AEI_egarp) = .9055851063826594 r(SIM_egarp) = 1000 r(EFF_egarp) = 1 r(GOODS_egarp) = 5 r(OBS_egarp) = 20 macros: r(AXIOM_egarp) : "eGARP" matrices: r(SUMSTATS_egarp) : 7 x 2 r(SIMRESULTS_egarp) : 1000 x 2
As opposed to the previous two commands, powerps can take several axioms in the axiom() option, as illustrated below:
Code:
. powerps, price(P) quantity(X) axiom(eWARP eSARP) sim(2000) aei progress Loop progress (2000) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 .................................................. 100 .................................................. 150 (output omitted) .................................................. 1950 .................................................. 2000 ------------------------------------------------------------------------------------------------------ Axioms | Power PS Pass AEI Sim Eff Goods Obs -------------+---------------------------------------------------------------------------------------- eWARP | .9905 -.0095 0 .9055851 2000 1 5 20 eSARP | .994 -.006 0 .9055851 2000 1 5 20 ------------------------------------------------------------------------------------------------------ Summary statistics for simulations: ----------------------------------------------- eWARP | #vio %vio AEI -------------+--------------------------------- Mean | 7.6935 4.049415 .8405483 Std. Dev. | 4.513174 2.375057 .0855724 Min | 0 0 .4537143 Q1 | 4 2.11 .7889272 Median | 7 3.68 .8519566 Q3 | 10 5.26 .9036704 Max | 31 16.32 1 ----------------------------------------------- ----------------------------------------------- eSARP | #vio %vio AEI -------------+--------------------------------- Mean | 39.382 10.36381 .8358594 Std. Dev. | 26.20529 6.896192 .0839901 Min | 0 0 .4537143 Q1 | 18 4.74 .7851447 Median | 36 9.47 .8458362 Q3 | 58 15.26 .897139 Max | 123 32.37 1 -----------------------------------------------
Comment