Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help fail tidy gracefully if model is intercept only #702

Open
leostimpfle opened this issue Nov 10, 2024 · 1 comment · May be fixed by #707
Open

Help fail tidy gracefully if model is intercept only #702

leostimpfle opened this issue Nov 10, 2024 · 1 comment · May be fixed by #707
Assignees
Labels
good first issue Good for newcomers

Comments

@leostimpfle
Copy link
Collaborator

Fitting an intercept only model, e.g., "Y ~ 1 | f1 + f2" will make the tidy method fail ungracefully because of an error in get_inference: ValueError: diag requires an array of at least two dimensions

It would be nice to catch the intercept-only case at an earlier stage in tidy (or maybe get_inference?) to avoid throwing hard-to-understand errors in get_inference.

Minimal working example:

import pyfixest as pf
data = pf.get_data(N=1000, seed=0, beta_type="2", error_type="2", model="Feols" )
feols = pf.feols("Y ~ 1 | f1 + f2", data )
feols.coef()
@leostimpfle leostimpfle added the good first issue Good for newcomers label Nov 10, 2024
@s3alfisc
Copy link
Member

s3alfisc commented Nov 10, 2024

Yep, very good point. This should also apply to a couple of other methods, i.e. summary(), etable(), coefplot() etc.

The error occurs because fitting a model with fixed effects and an intercept only never actually "fits" the model as there are no "coefficients" to fit and in consequence to display - it's mostly supported to allow users to residualize a variable by fixed effects without having to go down to the demean() function.

@leostimpfle leostimpfle self-assigned this Nov 11, 2024
@leostimpfle leostimpfle linked a pull request Nov 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants