Skip to content

SUMM/ENH: (roadmap) margins and get_prediction with generated exog #8746

Open

Description

@josef-pkt

We are still far away supporting margins as in Stata or margins/lsmeans/emmeans in R.

The main problem is getting the information to be able to construct multi-column exog and compute it's effects, e.g. derivatives w.r.t. original variable combined over several columns.
(I briefly looked at formulaic, but it's likely even worse than patsy for getting the required information out of it.)

what's possible

  • DOC, notebook: "Do it yourself marginal effects." I have most of it using _wald_nonlinear.
  • helper functions for constructing exog by user
  • add public versions of predict_nonlinear, wald_nonlinear based ib delta method.

maybe worth a try

  • black box derivatives for dy/dx, try numerical derivatives with predict "transform" (as generic as using python eval)
  • similar, can we support derivatives if we have user provided function

possible

  • support some cases that we can figure out, e.g. categorical without interaction similar to t_test_pairwise

difficult (not my kind of work)

  • can we use our own stateful transforms, e.g. polynomials, similar to what we do in GAM?
  • improve formulaic, e.g.
    • it has formula derivative w.r.t. x using sympy, but it does not work for categorical or categorical-continuous interaction.
    • more stateful transforms with extra methods like derivatives that we need.

many open issues

Activity

  1. added
    roadmap
    on Mar 19, 2023
  2. added this to the 0.15 milestone on Mar 19, 2023
  3. modified the milestones: 0.15, 0.16 on Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp-discretecomp-genmodroadmaptopic-predict

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions