vincentarelbundock / pymarginaleffects

GNU General Public License v3.0
47 stars 8 forks source link

comparison argument accepts lambda functions #66

Open vincentarelbundock opened 6 months ago

vincentarelbundock commented 4 months ago

@LamAdr This is a very similar issue to the one you solved in that PR, and I think it would be quite easy for you to fix. The feature is that currently the comparison argument in comparisons() accepts a string like "difference", and then goes here to retrieve the corresponding function:

https://github.com/vincentarelbundock/pymarginaleffects/blob/78ba24f7332b86053ddefb81654a3e0e288258bb/marginaleffects/estimands.py#L16

What we want is for that argument to accept either one of the allowable strings, or a lambda function of the same form as the ones in estimands.py. That way, people can supply their own custom-written comparison functions.