I have several models such as the example below for which I have estimates, standard errors, p-values, r2 etc. as data.frames in tidy format, but I don't have the original model objects (analysis was run on a different machine).
require(broom)
model <- lm(mpg ~ hp + cyl, mtcars)
tidy_model <- tidy(model)
glance_model <- glance(model)
# tidy_model
# # A tibble: 3 x 5
# term estimate std.error statistic p.value
# <chr> <dbl> <dbl> <dbl> <dbl>
# 1 (Intercept) 36.9 2.19 16.8 1.62e-16
# 2 hp -0.0191 0.0150 -1.27 2.13e- 1
# 3 cyl -2.26 0.576 -3.93 4.80e- 4
# glance(model)
# # A tibble: 1 x 11
# r.squared adj.r.squared sigma ...
# * <dbl> <dbl> <dbl> ...
# 1 0.760 0.743 3.06 ...
There exist several packages (e.g. stargazer
or texreg
) which transform one or more model objects (lm
, glm
, etc.) into well-formatted regression tables side-by-side, see below for an example of texreg
:
require(texreg)
screenreg(list(model1, model1)
# =================================
# Model 1 Model 2
# ---------------------------------
# (Intercept) 34.66 *** 34.66 ***
# (2.55) (2.55)
# cyl -1.59 * -1.59 *
# (0.71) (0.71)
# disp -0.02 -0.02
# (0.01) (0.01)
# ---------------------------------
# R^2 0.76 0.76
# Adj. R^2 0.74 0.74
# Num. obs. 32 32
# RMSE 3.06 3.06
# =================================
# *** p < 0.001, ** p < 0.01, * p < 0.05
Is there a similar package that uses tidy estimation results produced with broom
as inputs rather than model objects to produce a table such as the above example?
huxtable::huxreg
. It takes a list of models and callsbroom::(tidy|glance)
internally ... – Erde