jeffgortmaker / pyblp

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

Tutorial request: CustomMoment sample code #84

Closed fpinter closed 1 year ago

fpinter commented 3 years ago

I have some micro moments that, for one reason or another, are tricky to shoehorn into the existing micro moment classes (but probably not impossible). I'm considering writing CustomMoments to handle them.

To help with this process, would it be possible to write up examples of the functions that would implement the existing moment types (e.g., DemographicInteractionMoment and DiversionInteractionMoment) as CustomMoments? That way it would be easy for others to adapt that code for their particular needs.

jeffgortmaker commented 3 years ago

Yes! I've been meaning to do this exact idea for a while. Also serves as a nice unit test. I'm going to keep this open as a reminder -- thanks.

jeffgortmaker commented 1 year ago

The new micro moments tutorial should cover this. Micro moments are now sufficiently flexible that they should cover most types of statistics. The tutorial gives conditional expectations (ratios of unconditional expectations) as an example of how to define some arbitrary function of means as a statistic.