Search code examples
rdplyrregressionr-micesjplot

R: APA regression tables with mipo/mice objects


I have historically used sjPlot to create APA-style regression tables that export directly as a docx. Unfortunately, models based on imputed data (mipo objects) are not currently compatible with tab_model.

I am looking for a function similar to tab_model that can export APA-style regression tables directly to a Word Document in a single chunk without having to knit. Most packages I found (e.g., stargazer) seem to require knitting to create the table. Alternatively, if anyone knows a workaround to get mipo objects to work with tab_model, I would be most appreciative.

library(tidyverse)
library(sjPlot)
library(mice)
set.seed(123)

# error
data(nhanes)
imp <- mice(nhanes, m=3, print=FALSE)
with(imp, lm(age ~ bmi + chl)) %>% 
  pool() %>% 
  tab_model(.,
            file = "table.doc")
#> Error in fam.info$is_linear || identical(fam.info$link_function, "identity"): invalid 'x' type in 'x || y'

Solution

  • mice relies on broom::tidy() and broom::glance() within the pool() function. So I think the solution may be found in the combination of tab_model() with a broom object, such as here: https://github.com/strengejacke/sjPlot/issues/385.