I'm trying to use modelsummary for the following process:
- Estimate a multivariate regression ( j explanatory variables) per group (k groups) so that you have k estimates per each one of j variables.
- Average those k coefficients per each variable and calculate the corresponding t stat.
- Display those averages and t stats in one column as if they were estimates in a normal regression.
Statistically it is not the best approach but that's necessary in this case. It's basically averaged coefficients of k regressions. So my question is for the steps 2 and 3. Here is a reprex using mtcars just to calc averages and tstats:
fit<-mtcars %>% feols(c(mpg,hp )~1)
modelsummary(fit, estimate="{estimate}{stars}", stars = c('*' = .1, '**' = .05, '***'=0.01), output="flextable")
So this is the original ouptut
And I would like to stack those averages and tstats in one column like in the screenshot below.
There are several ways to do this but the best in this case imho would be to say within fixest+modelsummary+flextable workflow and I haven't been able to find the best approach for this. Would really appreciate any insight!