Skip to content

Helping demean() Fail Gracefully - Add a'fixef_iter' argument to feols() and fepois() #539

@b-knight

Description

@b-knight
Contributor

I've encountered instances when demean_.demean() runs endlessly - probably because I passed it a poorly structured data shape. I would like to be able to call a service that uses PyFixest, so calling the package on problematic data is a distinct possibility.

To this end, it would be great if there were ways to help the demean() method fail gracefully. Having some sort of mechanism for timing out could be handy, but the simplest approach that I can think of off hand is to make the 'maxiter' argument accessible from the feols() method in a manner similar to how the 'fixef_tol' argument is accessible to the user.

Activity

s3alfisc

s3alfisc commented on Jul 8, 2024

@s3alfisc
Member

Yes, I agree - it would be great to add a fixef_iter function argument to pyfixest.estimation.feols and pyfixest.estimation.fepois that would allow users to set the maximum number of iterations for the demeaning algo.

Overall, this should be straightforward enough:

  • We'd have to add a function argument fixef_iter to both functions & add docstrings.
  • We'd then have to propagate the argument to the FixestMulti class (just as fixef_tol) and assign it as an attribute.
  • For objects of class Feols and Feiv, from FixestMulti, we'd directly pass it to demean_model, where we finally can pass it to demean.
  • For objects of class Feiv, we'd pass the argument to Fepois, from which we can pass it to the internal calls to demean.
changed the title [-]Helping demean() Fail Gracefully - Make 'maxiter' Accessible from feols() [/-] [+]Helping demean() Fail Gracefully - Add a'fixef_iter' argument to feols() and fepois()[/+] on Jul 8, 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

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @b-knight@s3alfisc

      Issue actions

        Helping demean() Fail Gracefully - Add a'fixef_iter' argument to feols() and fepois() · Issue #539 · py-econometrics/pyfixest