jeffgortmaker / pyblp

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

Omega matrix Calculation #107

Closed mas0088 closed 2 years ago

mas0088 commented 2 years ago

Thank you for the great repository.

I wonder is there any predefined function to get omega matrix for each market? I see that after the estimation, the result dictionary (nevo_results.to_dict()) includes "omega" key, but the nevo_results.to_dict()["omega"] is empty.

Is there any way to get the omega?

jeffgortmaker commented 2 years ago

By omega do you mean the supply-side structural error? It's empty in the example you gave because that tutorial doesn't estimate a supply side. If you'd estimated a supply side (e.g. in the BLP 1995 tutorial) there should be an omega key.

chrisconlon commented 2 years ago

I bet it is ownership or Delta (d Q / d P).

On Thu, Feb 17, 2022 at 10:58 AM Jeff Gortmaker @.***> wrote:

By omega do you mean the supply-side structural error? It's empty in the example you gave because that tutorial doesn't estimate a supply side. If you'd estimated a supply side (e.g. in the BLP 1995 tutorial) there should be an omega key.

— Reply to this email directly, view it on GitHub https://github.com/jeffgortmaker/pyblp/issues/107#issuecomment-1043115640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7IOWKYYHBJ7GYHYJMRF2LU3ULLTANCNFSM5OTODJKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

mas0088 commented 2 years ago

I mean this matrix for each market: [dS1/dp1 dS2/dp1 ... dSk/dp1; dS1/dp2 dS2/dp2 ... dSk/dp2; .............................................. dS1/dpk dS2/dpk ... dSk/dpk]

jeffgortmaker commented 2 years ago

Yep, you can get this by re-scaling ProblemResults.compute_elasticities by s_jt / p_kt.

In the dev version of the code (not the above linked "stable" version) you can also directly use the ProblemResults.compute_demand_jacobian function.

mas0088 commented 2 years ago

I see, multiplying ProblemResults.compute_elasticities by s_jt / p_kt should give what I need. Thank you.