jeffgortmaker / pyblp

BLP Demand Estimation with Python
https://pyblp.readthedocs.io
MIT License
237 stars 81 forks source link

Question: Constant expenditures specification with micro moments #135

Closed ryosaka55 closed 1 year ago

ryosaka55 commented 1 year ago

I am attempting to estimate a demand model using the constant expenditures specification, which was employed in the study "Björnerstedt and Verboven (2016) Does merger simulation work? Evidence from the Swedish Analgesics market." Additionally, I intend to incorporate micro moments into the estimation. For example, I plan to match the average product characteristics conditional on income level.

As Björnerstedt and Verboven (2016) show, in this specification, market shares are measured in value, not in quantity. My formulations are something like this:

X1_formulation = pyblp.Formulation('0 + log(prices)', absorb='C(product_ids)') X2_formulation = pyblp.Formulation('1 + X1 + X2 + X3')

In this case, does pyBLP automatically use shares in value when calculating micro moment parts? I mean s_ijt(theta_0) in equation (10) of your paper "Incorporating Micro Data into Differentiated Products Demand Estimation with PyBLP".

Thanks for the help!

jeffgortmaker commented 1 year ago

PyBLP doesn't know how market shares were computed. It just takes shares in product_data as data that measure s_jt. Choice probabilities s_ijt (which as you noted enter into micro parts) will have the same interpretation as these shares, just at the consumer type i level.

So when incorporating micro moments, your definition of micro "choice" should be compatible with how you're defining market shares.

Usually, with a unit demand specification (i.e., when market shares are measured in quantity), each micro "choice" is the choice of a single unit of quantity. So when computing average product characteristics conditional on income level, you'll probably want to compute a weighted average, where weights are quantity purchased. In other words, you're computing a simple (conditional) average over each discrete choice of quantity.

With a constant expenditures specification (i.e., when market shares are measured in value), each micro "choice" is more like the choice of a single unit of value (e.g., dollar). So I think your averages would be weighted by dollars purchased, rather than quantities.

Does that sound right / make sense?

chrisconlon commented 1 year ago

This would create some issues if you incorporated a supply side or if you tried to compute counterfactual prices post merger for example.

In this case PyBLP is going to treat the shares as if they are quantities rather than revenues when solving for new prices, etc.

The same problem would arise if you had X3 formulas for supply.

On Sat, May 20, 2023 at 4:25 PM Jeff Gortmaker @.***> wrote:

PyBLP doesn't know how market shares were computed. It just takes shares in product_data as data that measure s_jt. Choice probabilities s_ijt (which as you noted enter into micro parts) will have the same interpretation as these shares, just at the consumer type i level.

So when incorporating micro moments, your definition of micro "choice" should be compatible with how you're defining market shares.

Usually, with a unit demand specification (i.e., when market shares are measured in quantity), each micro "choice" is the choice of a single unit of quantity. So when computing average product characteristics conditional on income level, you'll probably want to compute a weighted average, where weights are quantity purchased. In other words, you're computing a simple (conditional) average over each discrete choice of quantity.

With a constant expenditures specification (i.e., when market shares are measured in value), each micro "choice" is more like the choice of a single unit of value (e.g., dollar). So I think your averages would be weighted by dollars purchased, rather than quantities.

Does that sound right / make sense?

— Reply to this email directly, view it on GitHub https://github.com/jeffgortmaker/pyblp/issues/135#issuecomment-1555990794, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7IOWN6TJKS7A4OPVQ5KHDXHESCTANCNFSM6AAAAAAYI5KM5Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ryosaka55 commented 1 year ago

Thank you so much for your helpful comments!

I will first calculate the average of product characteristics conditional on income level from the micro data as a value-weighted average, not as a simple average. I think this will make sure that the simulated analog of my micro moment is compatible with the observed value.

I will also keep in mind the issue of including supply-side. I will manually solve fixed point equations of equilibrium prices when I want to compute counterfactual prices.

Thanks a lot!!

jeffgortmaker commented 1 year ago

Sounds good! I'm going to close this for now, but feel free to re-open / keep commenting if you have more questions on this.

ryosaka55 commented 1 year ago

Sorry for bothering you many times. I have more questions.

With using constant expenditure specifications (log (prices) is specified), do the commands ".compute_elasticities()" and "compute_aggregate_elasticities" generate correct elasticities?

I am concerned about this point since the constant expenditure specification model has a different formula for price elasticities.

Thanks for your help!

jeffgortmaker commented 1 year ago

No worries!

They generate elasticities with respect to prices, not log(prices). In general, utility derivatives with respect to various characteristics are computed symbolically with SymPy.

So they're correct if that's what you want? Not sure what the correct elasticity formula is in this case.