*! version 2.0 29nov2014

help blp

Title

blp -- Berry Levinsohn Pakes random coefficients logit estimator

Syntax

blp
depvar [varlist] [if] [in],
endog([varlist_endog]=varlist_inst1)
stochastic(varname_s1=varlist_s1,varname_s2=varlist_s2,..)
markets(varname_m)
[optinst([varlist_inst2])
tolin(#)
tolout(#)
draws(#)
burn(#)
iter([#])
demofile(filename_d)
initsd(initvals)
initdemo(initvals_d)
elast(varname_e,#,[varname_p])
robustweight
robust
random
noisily
nocons]

Description

blp estimates the random parameters logit demand model from product market shares. This uses the GMM-estimator proposed by Berry Levinsohn and Pakes(1995) and
allows for endogenous prices and consumer heterogeneity in the valuation of product characteristics, that can be explained by variation in demographic variables. To
reduce the bias and improve both the efficiency and stability of the estimator, blp provides an option to use the Chamberlain(1987) optimal instruments.

Options for blp

endog([varlist_endog]=varlist_inst1) is required and identifies varlist_endog as any endogenous variables and varlist_inst1 as the instruments
for varlist_endog and the parameters in stochastic

stochastic(varname_s1=varlist_s1,varname_s2=varlist_s2,..) is required and identifies varname_s1, varname_s2,.. as product
characteristics with random coefficients and varlist_s1,varlist_s2,.. as demographic variables that appear in these equations. Random coefficients can only
be associated with variables that appear in varlist or varlist_endog. For a random-constant, it is necessary to generate and include a variable named cons.

markets(varname_m) identifies varname_m as the market variable in the data and in the demographic file filename_d if used.

optinst([varlist_inst2]) estimates the model using Chamberlain(1987) optimal instruments. For models that include endogenous regressors, varlist_inst2
contains subsets or functions of varlist_inst1 that appear in the linear (in parameters) conditional expectation of varlist_endog.

tolin(#) specifies the tolerance level used to define convergence of the contraction mapping algorithm. The default is 10E-15.

tolout(#) specifies the tolerance level used to define convergence of the GMM estimator. The default is 10E-12.

draws(#) specifies the number of Halton draws used to approximate the market share integrals. The default is 200 and the Halton sequence is created from the first
K-primes, where K denotes the number of stochastic coefficients.

burn(#) specifies the number of initial elements to drop when creating Halton sequences. The default is 15. This helps to reduce correlation between the sequences.

iter([#]) specifies the iterative instead of the two-step GMM estimator. It is available for optinst() or robustweight and estimation will continue
until the relative difference between estimates in successive iterations is below tolout(). Alternatively # specifies the number of iterations.

demofile(filename_d) identifies filename_d as the path to the file that contains the random draws of the demographic variables for each market.

initsd(initvals) identifies initvals as the starting values for the standard deviations of the random coefficients. These must be separated by a comma. The default
values are 0.5.

initdemo(initvals_d) identifies initvals_d as starting values for the coefficients on the demographic variables. The order will correspond to varlist_s1,varlist_s2,..
and values must be separated by a comma. The default values are 0.5.

elast(varname_e,#,[varname_p]) provides the matrix of demand elasticities for a 1% increase in variable varname_e, in market-number #. These are
available for varname_s1, varname_s2 etc only. An optional string variable varname_p can be specified to identify the products.

robustweight specifies a weighting matrix in the GMM-estimator that is optimal when the errors are correlated between products and heteroskedastic across markets. This option cannot
be used when the number of instruments equals the number of parameters, or when specifying optinst() as the model is exactly identified.

robust computes an estimate of the standard errors that are robust when the errors are correlated between products and heteroskedastic across markets.
The default assumes that the errors are iid.

random specifies that pseudo-random draws be used to approximate the market-share integrals instead of those based on Halton sequences. Following Drukker and Gates(2006) it is
suggested that this option is selected when the number of stochastic coefficients exceeds 10.

noisily displays the iteration log during estimation. This indicates convergence of the contraction mapping by market and displays the
current values of the heterogeneity parameters and associated analytical gradients.

nocons estimates the model without the constant term in the mean utility.

Remarks

blp requires the data to be in long form, where each market contains observations on product shares and characteristics. There is no requirement for products to be the same across markets.

The number of Halton draws # in draws(#) is set to 200 by default, but the user should test the stability of the estimator for larger values.

If demographic variables are used, it is necessary for filename_d to contain an equal number of draws across markets (in long-form) and with the same market identifier varname_m.
This number will override #. As Nevo(2000) points out, identification of the demographic coefficients requires variation in the distribution of demographic variables across markets.

For models that include a random coefficient on the constant, Monte Carlo experiments indicate that it is very difficult to identify the standard deviation of this characteristic, in addition
to the associated coefficients on the demographic variables.

Simulation studies by Reynaert and Verboven (2014) and repeated using blp, report reductions in small-sample bias and improvements in the efficiency of the
GMM-estimator using optimal instruments. Furthermore, optimal instruments help to improve the stability of the estimator (less spikes at zero for the standard deviations of the random coefficients).

Examples

Example 1: No demographic variables

In this example, consumers can select from J=10 alternatives excluding the outside good. Data is simulated for T=25 markets and utility is determined by a
constant, a single product characteristic x1 and price p which is endogenous. The supply side is characterized by perfect competition, where marginal
costs are a linear function of the product characteristics and three exogenous cost drivers w1, w2 and w3. Heterogeneity is restricted to
the coefficient on x1 which has a true mean valuation of 2 and a standard deviation of 1. The constant is set to 2 and the coefficient on price is -2.

Standard instruments

The model is initially estimated by generating the BLP-type instrument set. This contains the exogenous variables, their squares and interactions
and the sums of the characteristics of other products. Construction of these instruments is set-out below.

. use blp_nodemo,clear

. gen w12=w1^2

. gen w22=w2^2

. gen w32=w3^2

. gen x12=x1^2

. gen x1w1=x1*w1

. gen x1w2=x1*w2

. gen x1w3=x1*w3

. bysort mkt: egen x1s=sum(x1)

. replace x1s=x1s-x1

(250 real changes made)

. blp s x1, stochastic(x1) endog(p=w1 w2 w3 w12 w22 w32 x12 x1w1 x1w2 x1w3 x1s) markets(mkt)

Iteration 0: f(p) = 13.131515
Iteration 1: f(p) = 13.087338 (backed up)
Iteration 2: f(p) = 12.942222
Iteration 3: f(p) = 12.94162
Iteration 4: f(p) = 12.941619

GMM estimator of BLP-model

GMM weight matrix: unadjusted Number of obs = 250
Number of markets = 25
Number of Halton draws = 200

+

| Coef. Std. Err. z P>|z| [95% Conf. Interval]

+

Mean utility |
cons | 1.86419 .7076256 2.63 0.008 .4772692 3.25111
x1 | 2.411279 .5984685 4.03 0.000 1.238302 3.584256
p | -2.040571 .0486975 -41.90 0.000 -2.136016 -1.945125

+

x1 |
SD | .7360524 .485933 1.51 0.130 -.2163588 1.688464

+

Optimal instruments

Prices are a linear function of cost-drivers w1,w2,w3 and product characteristics 1,x1. Hence to estimate the model using
optimal instruments, optinst(z1,z2,z3) is specified where 1,x1 are included by default.

. blp s x1, stochastic(x1) endog(p=w1 w2 w3 w12 w22 w32 x12 x1w1 x1w2 x1w3 x1s) markets(mkt) optinst(w1 w2 w3)

Iteration 0: f(p) = 13.131515
Iteration 1: f(p) = 13.087338 (backed up)
Iteration 2: f(p) = 12.942222
Iteration 3: f(p) = 12.94162
Iteration 4: f(p) = 12.941619
Estimation iteration with optimal instruments: 1

Iteration 0: f(p) = 2.8867191 (not concave)
Iteration 1: f(p) = .34409293
Iteration 2: f(p) = .00141696
Iteration 3: f(p) = 6.520e-07
Iteration 4: f(p) = 1.280e-13
Iteration 5: f(p) = 3.733e-23

GMM estimator of BLP-model

Instruments: Chamberlain optimal Number of obs = 250
Number of markets = 25
Number of Halton draws = 200

+

| Coef. Std. Err. z P>|z| [95% Conf. Interval]

+

Mean utility |
cons | 2.133752 .4500017 4.74 0.000 1.251765 3.015739
x1 | 2.210469 .3285757 6.73 0.000 1.566472 2.854465
p | -2.05896 .044855 -45.90 0.000 -2.146874 -1.971046

+

x1 |
SD | .9145327 .1882391 4.86 0.000 .5455907 1.283475

+

The parameter estimates are now closer to the true values and with smaller standard errors compared with those estimated using the sub-optimal set.

Example 2: Demographic Data

This example extends the previous model to include a random coefficient on price p, with a standard deviation of 1 and two demographic variables
d1,d2 in the coefficient equation for x1. The marginal effects of d1 and d2 are both 1 and samples are drawn from independent normal
distributions. To permit parameter identification, the mean and variance are allowed to differ across markets. File demodata.dta contains 500 draws (per market)
selected at random from the simulated population of individuals used to construct the product shares. The model is estimated with optimal instruments and price
elasticities are reported for market 1 by specifying elast(p,1,product), where product is a string variable that contains product names to label the elasticity matrix.

. use blp_demo,clear

. gen w12=w1^2

. gen w22=w2^2

. gen w32=w3^2

. gen x12=x1^2

. gen x1w1=x1*w1

. gen x1w2=x1*w2

. gen x1w3=x1*w3

. bysort mkt: egen x1s=sum(x1)

. replace x1s=x1s-x1

(250 real changes made)

. blp s x1, stochastic(x1=d1 d2,p) endog(p=w1 w2 w3 w12 w22 w32 x12 x1w1 x1w2 x1w3 x1s) markets(mkt) optinst(w1 w2 w3) demofile(demodata) initdemo(1,1) initsd(1,1) elast(p,1,product)

number of draws set to number in demographic data file
draws per market is: 500
Initial values for included demographic-variables in stochastic coefficient equations

d1 d2
x1 1 1
p . .
Do you wish to continue?: 1=yes, 0=no?. 1
estimation continuing
Iteration 0: f(p) = 18.345114 (not concave)
Iteration 1: f(p) = 11.518583
Iteration 2: f(p) = 10.731243
Iteration 3: f(p) = 10.709159
Iteration 4: f(p) = 10.708926
Iteration 5: f(p) = 10.708926
Estimation iteration with optimal instruments: 1
Iteration 0: f(p) = 1.325197
Iteration 1: f(p) = .00047773
Iteration 2: f(p) = 3.454e-09
Iteration 3: f(p) = 4.583e-18

GMM estimator of BLP-model

Instruments: Chamberlain optimal Number of obs = 500
Number of markets = 50
Number of Halton draws = 500

+

| Coef. Std. Err. z P>|z| [95% Conf. Interval]

+

Mean utility |
cons | 1.562526 .4870916 3.21 0.001 .6078444 2.517208
x1 | 2.144829 .1669901 12.84 0.000 1.817535 2.472124
p | -1.938477 .1165748 -16.63 0.000 -2.16696 -1.709995

+

x1 |
d1 | .9794679 .0728124 13.45 0.000 .8367581 1.122178
d2 | .9406059 .0740145 12.71 0.000 .7955401 1.085672
SD | .9448503 .204845 4.61 0.000 .5433616 1.346339

+

p |
SD | .9726345 .0751903 12.94 0.000 .8252641 1.120005

+

The estimated marginal effects of d1 and d2 on the x1 coefficient are approximately 0.98 and 0.94. To display the price elasticity matrix type:

.

. matrix list e(elast)

( only products 1 - 3 displayed)

e(elast)[10,10]
1% rise in p:
product1 product2 product3
% change in: product1 -3.1977628 .65508214 .07305337
product2 1.1187173 -4.2095821 .0890736
product3 1.029381 .73495422 -4.7211944

The ij-elements of the elasticity matrix represent (approximately) the %-change in the demand
for product i, following a 1% increase in the price of product j.

Author

David Vincent

Deloitte Economic Consulting LLP

Athene Place, 66 Shoe Lane, London, EC4A 3BQ

davivincent@deloitte.co.uk

References

Berry, S., J. Levinsohn, and A. Pakes, (1995), “Automobile Prices in Market Equilibrium,” Econometrica, 63, 4, 841-90.

Nevo, Aviv, (2000), “A Practitioner's Guide to Estimation of Random-Coefficients Logit Models of Demand,” Journal of Economics & Management Strategy.

Reynaert, M., and F. Verboven, (2014), “Improving the performance of random coefficients demand models: the role of optimal instruments”, Journal of Econometrics, 179, 83-98