jeffgortmaker / pyblp

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

Question: Is it possible to restrict the random coefficients to correlate? #125

Closed jakob-ditfurth closed 1 year ago

jakob-ditfurth commented 1 year ago

Dear Jeff,

I was wondering if it was possible to restrict random coefficients in the model to correlate in your package? I was not able to find an option for this in the package: image

As you can see, gamma is both in front of z but also delta z, where it is multiplied with tau, however.

Many thanks!

jeffgortmaker commented 1 year ago

How are gamma and tau distributed?

In some special cases you may be able to do this type of structure with some combination of 'log' random coefficient types and product-specific demographics (see rc_types and the bottom of agent_data here).

But in general I suspect that PyBLP won't support this exact type of restriction at the moment. Of course you can always approximate it with something like a bunch of additive normal mixtures, but this would require estimating more parameters.

jakob-ditfurth commented 1 year ago

The parameters are assumed to be distributed normally - I will try to see whether I could implement this with rc_types or agent_data. Thank you!

jeffgortmaker commented 1 year ago

The product of normals isn't very tractable, so my guess is you won't be able to exactly implement the distribution. But an approximation is always possible.

I'll close this issue for now, but please re-open/keep commenting if you have other questions.