I run a linear regression for which I adjust the p-values. When I want to display it using modelsummary()
the model displayed does not show me the adjusted p-values. Here is a reproducible example:
library(modelsummary)
library(estimatr)
d<- data.frame(x=c(1,2,31,1,3),y=c(35,6,32,2,2),w=c(15,42,361,1,33),z=c(35,6,32,24,24))
g1<- lm_robust(x~y,d)
g2<- lm_robust(w~z,d)
p <- p.adjust(c(g1$p.value,g2$p.value), method = "fdr")
g1$p.value <- p[1:2]
g2$p.value <- p[3:4]
modelsummary(models=list(g1,g2), statistic = "p.value")
For instance, regression g1
looks like:
print(g1)
Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper DF
(Intercept) 1.1768425 1.9767101 0.5953541 0.7913711 -5.113931 7.467616 3
y 0.4170882 0.5123141 0.8141258 0.7913711 -1.213324 2.047500 3
But modelsummary()
only displays the non-adjusted p-values.
I have been stuck on that problem for quite a while now. First, I thought that this answer would be helpful: How to add a q value (adjusted p-value) to a modelsummary table after pooling the results of a multinomial model over multiple imputed datasets. But they only seem to correct p-values within regressions... I guess the difficulty comes from the fact that I am adjusting p-values across multiple regressions.
Thanks for your help!