py-econometrics / pyfixest

Fast High-Dimensional Fixed Effects Regression in Python following fixest-syntax
https://py-econometrics.github.io/pyfixest/
MIT License
175 stars 35 forks source link

Multiple Functions require lists of Feols/Feiv/Fepois object; reject FixestMulti #693

Open s3alfisc opened 2 weeks ago

s3alfisc commented 2 weeks ago

Currently, pf.bonferroni(), pf.rwolf(), pf.coefplot(), pf.iplot() all require an input type list[Union[Feols, Feiv, Fepois]]. If a FixestMulti object is provided, the functions will return an error:

import pyfixest as pf

data = pf.get_data()
fit = pf.feols("Y + Y2 ~ X1", data = data)

#pf.bonferroni(fit, param = "X1")
#                The models argument must be either a list of Feols or Fepois instances, or
#                simply a single Feols or Fepois instance. The models argument does not accept instances
#                of type FixestMulti - please use models.to_list() to convert the FixestMulti
#                instance to a list of Feols or Fepois instances.

pf.bonferroni(fit.to_list(), param = "X1")
# runs without error

It would be nice to internally convert FixestMulti objects to lists by calling the to_list() method internally.