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

Stars in fixest #651

Closed
vincentarelbundock opened this issue Jul 3, 2023 · 2 comments
Closed

Stars in fixest #651

vincentarelbundock opened this issue Jul 3, 2023 · 2 comments

Comments

@vincentarelbundock
Copy link
Owner

vincentarelbundock commented Jul 3, 2023

Hello, I am running into similar issues when using modelsummary with the fixest package. The p-values in my fixest results do not match those printed by modelsummary.

  • p-value for language variable from fixest estimate: 0.013087
  • p-value for language variable printed in modelsummary: 0.03491

Code is below. I made sure to install the latest development versions of modelsummary and fixest, but these didn't fix the issue. Apologies if I'm missing something. Any help would be appreciated.

library(modelsummary)
library(fixest)
library(carData)
d <- Greene
d$dv <- ifelse(Greene$decision == 'yes', 1, 0)

mod <- feglm(dv ~ language | judge,
             data = d,
             cluster = c('judge'), family = 'logit')

mod
modelsummary(mod, fmt = '%.5f', statistic = "{std.error} ({p.value})")

Originally posted by @knrob in #264 (comment)

@vincentarelbundock
Copy link
Owner Author

Very sorry the delay. Work has been crazy, then vacation, etc.

The problem is that modelsummary uses parameters to extract p values. parameters uses the t distribution and believes that this particular model has only 9 degrees of freedom (it has more). So we get overly conservative results.

library(fixest)
library(carData)
d <- Greene
d$dv <- ifelse(Greene$decision == 'yes', 1, 0)

mod <- feglm(dv ~ language | judge,
             data = d,
             cluster = c('judge'), family = 'logit')

insight::get_df(mod)
# [1] 382

pnorm(-2.48139) * 2
# [1] 0.01308711
pt(-2.48139, df = 9) * 2
# [1] 0.03491173

This should be fixed upstream, so I opened an issue here: easystats/parameters#892

@vincentarelbundock
Copy link
Owner Author

tag @kbroman

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

No branches or pull requests

1 participant