jeffgortmaker / pyblp

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

Simulated prices after cost decrease #116

Closed mas0088 closed 1 year ago

mas0088 commented 1 year ago

Hi. Thank you for the great repo.

I was able to estimate the marginal costs using this repository. Let's assume the data covers 20 years and I would like to understand what will happen to prices if some firms have a 10% cost decrease starting in year 11. Will the simulation package support this kind of analysis? If yes, any brief guide will be highly appreciated.

Thank you

jeffgortmaker commented 1 year ago

Sure - if you reduce the elements in your estimated vector of marginal costs (which are in the same order as your product data) that are in years 11+ by 10% and pass these to the costs argument of ProblemResults.compute_prices (https://pyblp.readthedocs.io/en/stable/_api/pyblp.ProblemResults.compute_prices.html#pyblp.ProblemResults.compute_prices), this will compute the corresponding equilibrium prices.

Of course this is under the same static Bertrand-Nash pricing assumption that was made to recover marginal costs.

mas0088 commented 1 year ago

Thank you Jeff.

It means that if I just estimate the marginal costs using

mc = ProblemResults.compute_costs()

and give these estimated costs (without any change) to

ProblemResults.compute_prices(costs = mc)

Should I get exactly my initial prices? Or because of the contraction mapping, there will still be some differences? If there will be some differences, is there an option to set the starting values or convergence tolerance?

jeffgortmaker commented 1 year ago

Yes, I think that's right -- there might be some small differences because of numerical error, but you should pretty much get your prices back if you don't modify the marginal cost estimates.

Take a look at the linked docs! The prices argument specified the starting values, and you can use the iteration argument to specify a non-default iteration configuration with a different termination tolerance.

mas0088 commented 1 year ago

Great. Thank you.