wald() and pvalue()/coeftable() use different reference distributions for Poisson models

Open
#689 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
47/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
backend

Research direction

Start by tracing how wald(), pvalue(), and coeftable() choose reference distributions for fepois and feglm, then check the change in 0.14.0 associated with #634. Reproduce the mismatch with the supplied example and compare the Poisson result with feols; done when the methods use a consistent rule and regression coverage confirms their p-values agree for a single-coefficient test.

Written by the indexing model from the issue text.

Description

Hi!

I found a small inconsistency: for fepois models (and presumably feglm with a binomial family), wald() and the coefficient-level inference (pvalue(), coeftable(), confint()) use different reference distributions. As a result, the same single-coefficient hypothesis gets very different p-values. For feols the two agree.

library(fixest)
data(trade)

gravity_ols <- feols(
  Euros ~ log(dist_km) |
    Origin + Destination + Product + Year,
  cluster = ~ Origin + Destination,
  trade
)

fixest::pvalue(gravity_ols)
#> log(dist_km) 
#>  0.001241529 
#> attr(,"vcov_type")
#> [1] "Clustered (Origin & Destination)"
fixest::wald(gravity_ols)
#> Wald test, H0: nullity of log(dist_km)
#>  stat = 16.2, p-value = 0.001242, on 1 and 14 DoF, VCOV: Clustered (Origin & Destination).

gravity_pois <- fepois(
  Euros ~ log(dist_km) |
    Origin + Destination + Product + Year,
  cluster = ~ Origin + Destination,
  trade
)

fixest::pvalue(gravity_pois)
#> log(dist_km) 
#> 1.486652e-31 
#> attr(,"vcov_type")
#> [1] "Clustered (Origin & Destination)"
fixest::wald(gravity_pois)
#> Wald test, H0: nullity of log(dist_km)
#>  stat = 136.6, p-value = 1.312e-8, on 1 and 14 DoF, VCOV: Clustered (Origin & Destination).

print(packageVersion("fixest"))
#> [1] '0.14.2'

Created on 2026-10-27 with reprex v2.1.1

For OLS, both use t(G_min − 1) = t(14), so the F(1, 14) Wald p-value equals the t-test p-value. For Poisson:

  • pvalue() uses the normal distribution, since use_t_distr() returns FALSE for the poisson/binomial families.
  • wald() uses F(q, df.t) with df.t = G_min − 1 regardless of the family.

If I read the code and NEWS correctly, this started in 0.14.0, when wald() began using the effective sample size (#634).

I'm not sure which behaviour is intended. Either way, it would help if wald() and the coefficient table followed the same rule for a given model.

Thanks for clarifying!

Dominant language
R
Stars
464
Forks
82
Avg merge
2d 7h
Merged PRs (30d)
12

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lrberge/fixest

All issues in lrberge/fixest

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.