Skip to content

test: add cluster equivalence tests for tidy/glance.fixest#1278

Closed
LeonidasZhak wants to merge 1 commit into
tidymodels:mainfrom
LeonidasZhak:fix/fixest-glance-cluster-test
Closed

test: add cluster equivalence tests for tidy/glance.fixest#1278
LeonidasZhak wants to merge 1 commit into
tidymodels:mainfrom
LeonidasZhak:fix/fixest-glance-cluster-test

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds tests verifying that tidy(fit, cluster=...) and glance(fit, cluster=...) produce the same results as tidying/summarizing a pre-clustered summary.fixest object.

Problem

The existing test-fixest.R tests tidy() and glance() with se = "hetero" equivalence against a pre-summarized object, but the same pattern was not tested for the cluster argument. This means the cluster-pass-through behavior of both tidy.fixest and glance.fixest was untested.

Fix

Added a test block inside the existing "tidiers work with model results or summary of model results" test that:

  • Creates a pre-clustered summary: summary(fit2, cluster = c("id", "v1"))
  • Verifies tidy(fit2, cluster = ...) matches tidy(fit2_clust)
  • Verifies tidy(fit2, cluster = ..., conf.int = TRUE) matches
  • Verifies glance(fit2, cluster = ...) matches glance(fit2_clust)

Relation to PR #1276

PR #1276 added dedicated test blocks for the cluster and vcov arguments on tidy.fixest. This PR adds the missing glance.fixest cluster equivalence test. The two PRs are complementary and do not conflict.

Validation

  • New equivalence assertions pass (verified locally with R 4.5.2)
  • No existing tests broken

Files changed

  • tests/testthat/test-fixest.R — 9 lines added

Add tests verifying that tidy(fit, cluster=...) and glance(fit, cluster=...)
produce the same results as tidying/summarizing a pre-clustered summary object.
Complements PR tidymodels#1276 which added cluster/vcov tests for tidy but not glance.
@LeonidasZhak

Copy link
Copy Markdown
Author

Withdrawing this small automated PR while I consolidate an oversized batch of contributions and reduce maintainer review burden. Sorry for the noise, and thank you for maintaining the project.

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