# STATA: Estimation of Own-Price and Cross-Price Elasticities for Logit, Nested Logit, and BLP Models

I am working with some data on automobile sales and characteristics in a small country. It is an unbalanced panel dataset taken over 6 years and over 5 market segments. I am trying to construct some discrete-choice demand models using Stata, using two OLS models (one where Price comes in linearly, one where Price is logged) and a nested logit. I will do my BLP instruments model next.

The OLS models are: δj=ln P(j)-ln P(0)=βxj-αpj+εj

and

δj=ln P(j)-ln P(0)=βxj-αln(pj)+εj

The nested logit is as follows:

δj=ln P(j)-ln P(0)=βxj-αpj+σ[ln P(j)- ln P(g)]+ξj for j∈g.

Where P(j) and P(0) represent, respectively, the probability of buying good j and the probability of buying an outside good. Xj is a vector of the characteristics of each good j (in this case, I am using CC/weight, Maximum Speed/100 and Size = Length*Width/10000), and pj is the price of good j.

The code I have used to define my variables and then runmy regressions is as follows:

gen lnPj=ln(Sj)
gen lnPg=ln(Sg1)
gen deltaj=ln(Sj/S0)
gen MSP100=0.01*MSpeed
gen LW10000= Length*Width*.0001
gen diffPjPg= lnPj-lnPg
reg deltaj CCW MSP100 LW10 P, robust
reg deltaj CCW MSP100 LW10000 lnP, robust
reg deltaj CCW MSP100 LW10 lnP diffPjPg, robust


So far, I have computed the own-price elasticities with the code:

gen OPE_PLogit=-.4894868*P*(1-Sj) for the first model and

gen OPE_lnPLogit=-1.959741*P*(1-Sj) for the second model

where Sj is the market share of that particular car for that particular year. I do know that in Stata, generally, one computes the elasticity using the -margins- command.

Let kk be any good but jj, α be the coefficient on price, η be the price elasticity, Sj be the own-market share, Sg be the share for a particular class of cars, e.g. Sedans, Sk be the share for all cars within a group except car j, and S0 be the overall share for cars other than J. The question is this: given that I have directly specified the regression equation and obtained good regression coefficients, is it still appropriate to use the formula η=αPj⋅(1−Sj)η=αPj⋅(1−Sj) normally used to compute the own-price elasticity and η=αPk⋅Skη=αPk⋅Sk (.) for the cross-price elasticity if I am using an unbalanced panel dataset? I think I recall my professor saying that an unbalanced panel dataset will adversely affect the elasticities, but I'm not sure how to adjust for this.