Skip to content

Providing direct access to internal estimation classes Feols, Fepois, Feglm, Feiv via a scikit-learn style API including improved handling of regression weights and inheritance #1180

@s3alfisc

Description

@s3alfisc

Background

PyFixest estimation capabilities are implemented in a set of core classes: Feols, Feiv, Fepois, Feglm, Quantreg, FeolsCompressed. All models classes live in estimation/models.

All of the classes inherit from Feols and are currently internal only.

To do

  • We would like to change inheritance: all classes should inherit from a BaseRegression class instead of Feols.
  • All classes should follow a scikit-learn and Formula API and should be accessible to users. In other words, users should be able to fit a regression as
from pyfixest import Feols
fit = Feols().from_formula(fml = fml, data = data).fit()

or

fit = Feols().fit(X = X, y = y, fe = fe)
  • Last, for WLS, all weights are pre-multiplied with Y, X, which makes it hard to track if a variable is "raw" or already weighted. Similar patterns exist for demeaned vs non-demeaned data .
  • Add tests and documentation.

Complications

  • Many of the fitting steps are currently orchestrated in the FixestMulti class and would have to be moved within the individual model classes.
  • PyFixest provides rich post-estimation capabilities. For example, the summary function prints an estimation formula. vcov can adjust standard errors post estimation and might not find the cluster variable in a data frame that has not been passed via the numpy API. In these cases, we either need to slightly adjust the API as well, or fall back to sensible defaults.

Past related issues

which I am all closing in place of this new issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions