To estimate the matrix of own- and cross-price elasticities it is more convenient to use the asclogit
command in Stata. Let's use the example in Cameron and Trivedi (2009) to show you the whole process to get this matrix. The data is on individual choices of whether to fish from the beach, the pier, a private boat or a chartered boat. They have three variables:
income
is each individual's income
p
is the price of each fishing alternative
q
is the quantity of fish that an individual can obtain from each fishing alternative
Note that income
is individual specific (a consumer characteristic) and p
and q
are choice specific (the product characteristics). Now let's first estimate the choice model and then obtain the matrix of own- and cross-price elasticities.
Obtain the data set and prepare it for the regression:
net from http://www.stata-press.com/data/musr
net install musr
net get musr
use mus15data.dta
reshape long d p q, i(id) j(fishmode beach pier private charter) string
Run the alternative specific clogit (asclogit
) model:
asclogit d p q, case(id) alternatives(fishmode) casevar(income) basealternative(beach) nolog
Alternative-specific conditional logit Number of obs = 4728
Case variable: id Number of cases = 1182
Alternative variable: fishmode Alts per case: min = 4
avg = 4.0
max = 4
Wald chi2(5) = 252.98
Log likelihood = -1215.1376 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
d | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
fishmode |
p | -.0251166 .0017317 -14.50 0.000 -.0285106 -.0217225
q | .357782 .1097733 3.26 0.001 .1426302 .5729337
-------------+----------------------------------------------------------------
beach | (base alternative)
-------------+----------------------------------------------------------------
charter |
income | -.0332917 .0503409 -0.66 0.508 -.131958 .0653745
_cons | 1.694366 .2240506 7.56 0.000 1.255235 2.133497
-------------+----------------------------------------------------------------
pier |
income | -.1275771 .0506395 -2.52 0.012 -.2268288 -.0283255
_cons | .7779593 .2204939 3.53 0.000 .3457992 1.210119
-------------+----------------------------------------------------------------
private |
income | .0894398 .0500671 1.79 0.074 -.0086898 .1875694
_cons | .5272788 .2227927 2.37 0.018 .0906132 .9639444
------------------------------------------------------------------------------
A negative coefficient for the price means that if the price of one fishing choice increases, then the demand for this choice decreases and the demand for the other choices increases. Conversely, if the quantity of fish caught increases in one choice, the demand for this choice increases and decreases for the other choices.
Now the own- and cross price elasticities are
$$
\begin{align}
\frac{\partial p_{ij}}{\partial x_{rik}} &= p_{ij}(1-p_{ij})\beta_r, \qquad j=k \quad\text{(own-price elasticity)} \newline
\frac{\partial p_{ij}}{\partial x_{rik}} &= -p_{ij}p_{ik}\beta_r, \quad \quad \quad j \neq k \quad \text{(cross-price elasticity)}
\end{align}
$$
for the alternative choice $r$ (relative to the baseline choice; here the baseline is "beach").
The own- and cross-price elasticities are easily estimate as:
estat mfx, varlist(p)
Pr(choice = beach|1 selected) = .05248806
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
p |
beach | -.001249 .000121 -10.29 0.000 -.001487 -.001011 103.42
charter | .000609 .000061 9.97 0.000 .000489 .000729 84.379
pier | .000087 .000016 5.42 0.000 .000055 .000118 103.42
private | .000553 .000056 9.88 0.000 .000443 .000663 55.257
-------------------------------------------------------------------------------
Pr(choice = charter|1 selected) = .46206853
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
p |
beach | .000609 .000061 9.97 0.000 .000489 .000729 103.42
charter | -.006243 .000441 -14.15 0.000 -.007108 -.005378 84.379
pier | .000764 .000071 10.69 0.000 .000624 .000904 103.42
private | .00487 .000452 10.77 0.000 .003983 .005756 55.257
-------------------------------------------------------------------------------
Pr(choice = pier|1 selected) = .06584968
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
p |
beach | .000087 .000016 5.42 0.000 .000055 .000118 103.42
charter | .000764 .000071 10.69 0.000 .000624 .000904 84.379
pier | -.001545 .000138 -11.16 0.000 -.001816 -.001274 103.42
private | .000694 .000066 10.58 0.000 .000565 .000822 55.257
-------------------------------------------------------------------------------
Pr(choice = private|1 selected) = .41959373
-------------------------------------------------------------------------------
variable | dp/dx Std. Err. z P>|z| [ 95% C.I. ] X
-------------+-----------------------------------------------------------------
p |
beach | .000553 .000056 9.88 0.000 .000443 .000663 103.42
charter | .00487 .000452 10.77 0.000 .003983 .005756 84.379
pier | .000694 .000066 10.58 0.000 .000565 .000822 103.42
private | -.006117 .000444 -13.77 0.000 -.006987 -.005246 55.257
-------------------------------------------------------------------------------
All the own-price elasticities are negative and the cross-price elasticities are positive which makes sense. The own-price elasticity of -.001249
means that a 1 Dollar increase from the mean of p
(price) of fishing at the beach reduces the probability that beach fishing is chosen by 0.001249 for an individual with mean income and mean q
(fish caught).
So all elasticities are expressed relative to the mean values of income
, p
, and q
.
The cross-price elasticity .000609
tells you that if the price for fishing from a charter boat increases by 1 Dollar, the probability that beach fishing is chosen increases by .000609
. The result is not in matrix format but you can easily take each dp/dx
block from the results (each of which is a column for your final matrix) and put them together as a matrix of own- and cross-price elasticities where the own-price elasticities are on the principal diagonal and the cross-price elasticities are off diagonal like this:
beach charter pier private
------------------------------------------------
beach | -.001249 .000609 .000087 .000553
charter | .000609 -.006243 .000764 .00487
pier | .000087 .000764 -.001545 .000694
private | .000553 .00487 .000694 -.006117
The fishing choice example seems trivial but it should now be straightforward for you to apply your own demand estimation problem to the code provided. For more information on estimating these price elasticities or the asclogit
command have a look at Cameron and Trivedi (2009) "Microeconometrics Using Stata".
mfx
was superseded bymargins
, so you should probably be using the latter. You can benefit from: Stata tip 88 by Christopher Baum, Stata Journal (2010). $\endgroup$