Skip to content

FAQ-D/REF: data handling for multiple exog, multi-part models #3903

Open

Description

@josef-pkt

I have no idea what the best current approach is to handle a second exog.
AFAIK this has not been systematically added to model and might need refactoring.

The last case that Skipper added is for MixedLM
https://github.com/statsmodels/statsmodels/pull/2097/files#diff-65a46f8f38518560bd427a74998e9d24
and possibly relate "missing" handling by Kerby #3591

MixedLM.from_formula also has special, model specific code to handle the extra exog formula re_formula

cases:

The problem at the moment is that zero-inflated PR #3755 does not have full support for this, and it's not obvious how to add it.
Other models like IV2SLS don't allow formulas for instruments, but there the instruments are not in the param_names.
Several other multipart models are in PRs or in planning.

Activity

  1. josef-pkt commented on Sep 6, 2017

    @josef-pkt
    MemberAuthor

    another issue: How are other exog treated in llnull?

    example zero inflated or model with a second parameter specified as linear combination of some exog.
    If I add the second exog, exog_infl to _get_init_kwds, then the full second exog would be used in llnull. Instead we only want to use a constant also in the second exog. This happens if the second exog is None, i.e. the default.

    I don't know how general this is. E.g whether llnull in MixedLM includes any of the extra exog.

    similar unresolved/notimplemented in HetGLS: How does it work there? that model code is old.
    similar question in heckman or two stage models like IV. In that case 1st stage will not matter because we don't have an endogenous variable in the Null model.

    (workaround in count models: use specific llnull method that is already in DiscreteResults, and add another keyword _null_keys_drop or _exog_other_keys. I don't know which other use cases the extra list of keys would have.)

  2. josef-pkt commented on Sep 6, 2017

    @josef-pkt
    MemberAuthor

    missing handling:

    currently not supported in zero-inflated models.
    The general exog handling can be delegated to the sub-models, model_main and model_infl in zero-inflated. However, this does not go through the common missing handling, i.e. if there are missing different missing values in the two submodels, then this will break. (I think I don't fix this now in #3908)
    What's the pattern to get both pandas handling of separate exog or separate submodels and joint missing handling without a lot of spaghetti code?

  3. added this to the 0.16 milestone on Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions