Open pyoungblood opened 1 month ago
Do you have a minimal reproducible example with public data i can look?
---
title: "Bug repro"
output:
pdf_document:
geometry: margin=0.75in
header-includes:
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = F, echo = F, message=F, fig.pos = "!h", out.extra="")
options(tinytex.verbose = TRUE)
library(tidyverse)
library(tidylog)
library(fixest)
library(kableExtra)
library(modelsummary)
m1 <- feols(Fertility ~ Agriculture | Education, data = swiss)
m2 <- feols(Fertility ~ Agriculture + Examination | Education, data = swiss)
m3 <- feols(Fertility ~ Agriculture + Examination + Infant.Mortality +
Infant.Mortality*Infant.Mortality | Education, data = swiss)
m4 <- feols(Fertility ~ Agriculture + Examination + Catholic + Catholic*Catholic + Catholic*Examination +
Agriculture*Catholic | Education, data = swiss)
m5 <- feols(Fertility ~ Agriculture + Examination + Infant.Mortality + Infant.Mortality*Examination +
Infant.Mortality*Agriculture + Infant.Mortality*Infant.Mortality | Education, data = swiss)
models <- list("m1" = m1,
"m2" = m2,
"m3" = m3,
"m4" = m4,
"m5" = m5)
f <- function(x) formatC(x, digits = 4, big.mark = ",", format = "f")
msm <- modelsummary(models,
fmt = f,
vcov = ~ Examination,
output = "tinytable",
statistic = "({std.error}){stars}")
rows <- tibble(msm@data) %>%
filter(` ` == "") %>%
mutate(term = "") %>%
select(term,m1,m2,m3,m4,m5)
attr(rows, 'position') <- c(3,6,9,12,15,18,21,24,27)
modelsummary(models,
fmt = f,
stars = c('+' = .1, '*' = .05, '**' = .01, '***' = .001),
add_rows = rows,
estimate = "{estimate}",
statistic = "({std.error}){stars}",
vcov = "stata",
output = "kableExtra",
gof_omit = 'R2 Within|R2 Within Adj.|AIC|BIC|RMSE|Std.Errors',
notes = list("The values immediately below each coefficient are:",
"(1) the robust standard error",
"(2) the standard error clustered at Examination",
"Significance levels: + p<.1, * p<0.05, ** p<0.01, *** p<0.001"),
title = "Regression models")
I hope that I've posted that code correctly. It seems to me that if you add 1 to 6 additional rows to the regression table the GOF hrule border shifts down accordingly, but for more rows than 6, in this example there are 9, the GOF hrule does not shift any lower on the table.
Thanks for modelsummary
I have a minor bug to report. It seems that when using the add_rows function (in my case I am adding a second row of standard errors below each coefficient), the midrule above the goodness of fit section will only shift down a maximum of 6 rows.