With thanks to Kit Baum, the package hmindex is available on the SSC.
The hmindex command calculates the Houtman-Maks index (henceforth HM-index) for a dataset of prices and observed choice quantities sampled from an individual consumer or cross-section of individuals. The HM-index is a measure of the "size" of a violation of utility maximizing behavior. More specifically, the size of the violation is the maximal subset of observations consistent with some revealed preference axiom.
For illustration, let the observed prices and quantities of two goods be:
Running the command on these prices and quantities yields the following output:
We see that the HM-index is 0.75 (or 15 in absolute terms), which implies that 25% of the observations would have to be removed from the original data set in order for the data to be rationalizable by WGARP.
We can also inspect which observations are in the consistent set (CS) and violator set (VS), as follows:
r(INDICATOR_WGARP) is an indicator vector of the same length as the original price and quantity matrices with 1's and 0's indicating whether the observation is in the consistent set or not.
If you want a list of which observations are in the violator set, then r(OBSDROP_WGARP) provides the observation number (or position) of observations in the violator set.
The user also has the option to run simulations over uniformly random consumption behavior as a benchmark for the HM-index from observed data.
Here's an example of how one can visualize the actual HM-index and the HM-index from simulated uniformly random data over all subjects from Choi et al. (2007):
figure_1.eps
You can read more about the HM-index, the command and its applications here.
The hmindex command calculates the Houtman-Maks index (henceforth HM-index) for a dataset of prices and observed choice quantities sampled from an individual consumer or cross-section of individuals. The HM-index is a measure of the "size" of a violation of utility maximizing behavior. More specifically, the size of the violation is the maximal subset of observations consistent with some revealed preference axiom.
For illustration, let the observed prices and quantities of two goods be:
Code:
clear input p1 p2 x1 x2 8 2 27 22 4 4 44 33 6 6 22 25 6 5 32 20 2 1 20 49 6 3 26 33 7 9 20 49 5 1 25 43 9 9 24 20 8 1 28 41 4 7 25 41 5 6 24 39 4 3 38 37 8 6 47 26 8 2 49 43 5 7 26 27 7 6 34 31 10 1 31 47 8 1 36 46 8 2 28 32 end mkmat p1 p2, matrix(P) mkmat x1 x2, matrix(X)
Code:
. hmindex, price(P) quantity(X)
Number of obs = 20
Number of goods = 2
------------------------------------
Axiom | #HM %HM
-------------+----------------------
WGARP | 15 .75
------------------------------------
We can also inspect which observations are in the consistent set (CS) and violator set (VS), as follows:
Code:
. return list
scalars:
r(GOODS) = 2
r(OBS) = 20
r(HM_FRAC_WGARP) = .75
r(HM_NUM_WGARP) = 15
macros:
r(AXIOM) : " WGARP"
matrices:
r(CS_quantity_WGARP) : 15 x 2
r(CS_price_WGARP) : 15 x 2
r(INDICATOR_WGARP) : 20 x 1
r(OBSDROP_WGARP) : 5 x 1
r(VS_quantity_WGARP) : 5 x 2
r(VS_price_WGARP) : 5 x 2
If you want a list of which observations are in the violator set, then r(OBSDROP_WGARP) provides the observation number (or position) of observations in the violator set.
The user also has the option to run simulations over uniformly random consumption behavior as a benchmark for the HM-index from observed data.
Code:
. hmindex, price(P) quantity(X) dist
Number of obs = 20
Number of goods = 2
Simulations = 1000
------------------------------------
Axiom | #HM %HM
-------------+----------------------
WGARP | 15 .75
------------------------------------
Summary statistics for simulations:
------------------------------------
WGARP | #HM %HM
-------------+----------------------
Mean | 15.809 .79045
Std. Dev. | 1.510232 .0755116
Min | 11 .55
Q1 | 15 .75
Median | 16 .8
Q3 | 17 .85
Max | 20 1
------------------------------------
figure_1.eps
You can read more about the HM-index, the command and its applications here.
