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

Inference: Support fixef_k = "nested" for small sample correction in ssc() for identical standard errors with fixest #501

Open
s3alfisc opened this issue Jun 10, 2024 · 1 comment
Labels
breaking change Breaking Changes to PyFixest Functionality or User-Facing APIs enhancement New feature or request good first issue Good for newcomers

Comments

@s3alfisc
Copy link
Member

s3alfisc commented Jun 10, 2024

Context

At the moment, PyFixest's standard errors differ slightly from fixest defaults (explainer here).

This is because fixef_k = "nested" is not implemented in PyFixest - in contrast to fixest, the default argument of the ssc() function is fixef_k = "none" instead of "nested".

Per the fixest docs, "fixef.K="nested" discards all coefficients of fixed effects nested within clusters" when computing the number of coefficients $k$ for small sample corrections, while "fixef.K="none" discards all fixed-effects coefficients".

For examples of what is meant by a fixed effect nested in a cluster, take a look at the fixest vignette.

Image

Image

Task

Add the following variants to the fixef_k function argument of the

function:

  • fixef_k="nested"
  • fixef_k="full"

Add unit tests against fixest.

Change the default to ssc(fixef_k = "nested"), mirroring fixest.

Note that this introduces a breaking change to the PyFixest results - all default standard errors will deviate slightly.

@s3alfisc s3alfisc added enhancement New feature or request breaking change Breaking Changes to PyFixest Functionality or User-Facing APIs labels Jun 10, 2024
@s3alfisc s3alfisc changed the title Inference: Support fixef.K function argument in ssc() Inference: Support fixef_k = "nested" for small sample correction in ssc() for identical standard errors with foxest Jun 10, 2024
@s3alfisc s3alfisc changed the title Inference: Support fixef_k = "nested" for small sample correction in ssc() for identical standard errors with foxest Inference: Support fixef_k = "nested" for small sample correction in ssc() for identical standard errors with fixest Jun 10, 2024
@s3alfisc s3alfisc added the good first issue Good for newcomers label Jun 10, 2024
@valak70
Copy link

valak70 commented Jun 11, 2024

Hi @s3alfisc, I'm not familiar with fixest but what I understood is replacing fixef_k: str = "none" to fixef_k: str = "nested" will fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Breaking Changes to PyFixest Functionality or User-Facing APIs enhancement New feature or request good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

2 participants