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

Update wls types tests #562

Merged
merged 7 commits into from
Aug 4, 2024
Merged

Update wls types tests #562

merged 7 commits into from
Aug 4, 2024

Conversation

s3alfisc
Copy link
Member

@s3alfisc s3alfisc commented Jul 21, 2024

What this PR does:

  1. It slightly adjusts the default small sample corrections for heteroskedastic errors. It implements the following logic:
            adj1 = _N / (_N - 1)
            adj2 = (_N - 1) / (_N - _k)
            adj3 = _N / (_N - _k)

            adj1, adj2, adj3 = (np.array([x]) for x in [adj1, adj2, adj3])

            if _ssc_dict["adj"] and _ssc_dict["cluster_adj"]:
                self._ssc = adj3
            elif _ssc_dict["adj"] and not _ssc_dict["cluster_adj"]:
                self._ssc = adj2
            elif not _ssc_dict["adj"] and _ssc_dict["cluster_adj"]:
                self._ssc = adj1
            elif not _ssc_dict["adj"] and not _ssc_dict["cluster_adj"]:
                self._ssc = np.array([1.0])

which is exactly what r-fixest implements. See this issue in the fixest repo for details. Unit tests are updated accordingly.

  1. Adds a vignette that compares results from r-fixest with pyfixest. See here.

  2. Re-organizes some code logic in the Fepois method: self._X and self._Y are not multiplied with the IWLS weights. Now the logic is identical between the Feols, Feiv, and Fepois classes. Updates the CRV1 vcov method accordingly.

  3. Slightly refactors the vcov_hetero() method, for easier readability.

Too many only slightly related changes in this PR imho. Sorry about that!

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@s3alfisc s3alfisc merged commit 46261ab into master Aug 4, 2024
6 checks passed
@s3alfisc s3alfisc deleted the update-wls-types-tests branch August 4, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant