vincentarelbundock / pymarginaleffects

GNU General Public License v3.0
57 stars 9 forks source link

How to add support for a new model #119

Open saudiwin opened 1 month ago

saudiwin commented 1 month ago

Hey Vincent, it's me, your favorite annoying American programmer!! :sweat_smile:

As I mentioned on Twitter, I just came up with an MLE implementation of ordbetareg using scipy. Estimation of marginal effects with numerical differentiation should be straightforward as it's a standard MLE fit with Hessian, etc. However, there does not yet seem to a be a protocol for adding support for models to the pymarginaleffects package as there is with the R version. Any particular way you want me to go about doing this? I'm not an expert python programmer by any means, but chatGPT has proven to be remarkably helpful...

vincentarelbundock commented 1 month ago

Cool cool. I think the best place to look for an example might be here:

https://github.com/vincentarelbundock/pymarginaleffects/blob/main/marginaleffects/model_pyfixest.py

saudiwin commented 1 month ago

That looks great.

Would you want to define that as a general model class? I.e. if class = MarginalEffectsModel and all the methods are implemented, then it could pass the model sanity check.

Practically should I do a PR for this? I think it has to be within the codebase as I can't get around the model check otherwise.

vincentarelbundock commented 1 month ago

Yes, it would need to be a class like ModelOrdBetaReg, which inherits from ModelAbstract, as in the example I showed you.

A PR would be great, because otherwise I probably won't have time to implement this in the near future.

saudiwin commented 1 month ago

Yes indeed it does inherit from ModelAbstract, doesn't it 😂. I told you my Python skills are ... exceptional.

I'll put together a model_ordbetareg.py file and put it in a PR. Then I will constantly bug you / send threatening emails until you support the model.

Just kidding! There's no rush. I don't even like Python anyway.

On Mon, Sep 23, 2024 at 10:46 AM Vincent Arel-Bundock < @.***> wrote:

Yes, it would need to be a class like ModelOrdBetaReg, which inherits from ModelAbstract, as in the example I showed you.

A PR would be great, because otherwise I probably won't have time to implement this in the near future.

— Reply to this email directly, view it on GitHub https://github.com/vincentarelbundock/pymarginaleffects/issues/119#issuecomment-2368506974, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTVVOMQVTMVNW75G7Q5R4LZYASSTAVCNFSM6AAAAABOWEHJFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRYGUYDMOJXGQ . You are receiving this because you authored the thread.Message ID: @.***>