Skip to contents

Side-by-side regression table for multiple model fits

Usage

regression_table(
  models,
  exponentiate = FALSE,
  show_ci = TRUE,
  show_stars = TRUE,
  confidence = 0.95,
  digits = 3L,
  model_stats = c("nobs", "rsquared", "aic", "bic", "llf"),
  apa = FALSE,
  output_format = "dataframe",
  title = "Regression Results"
)

Arguments

models

Named list of fitted models (e.g. lm, glm).

exponentiate

Exponentiate coefficients (for OR / HR).

show_ci

Include CI line under each coefficient.

show_stars

Append significance stars.

confidence

Confidence level for CIs.

digits

Decimal places.

model_stats

Vector of model-stat keys from c("nobs","rsquared","aic","bic","llf").

apa

APA p-value formatting.

output_format

Output target.

title

Title.

Value

A character string.

Examples

set.seed(1)
df <- data.frame(y = rnorm(60), x = rnorm(60))
regression_table(list(ols = stats::lm(y ~ x, data = df)))
#>                          term             ols
#> (Intercept)       (Intercept)           0.112
#> .row2                                 (0.112)
#> .row3                         [-0.107, 0.332]
#> x                           x          -0.042
#> .row5                                 (0.123)
#> .row6                         [-0.282, 0.199]
#> N                           N              60
#> R-squared           R-squared           0.002
#> AIC                       AIC         156.370
#> BIC                       BIC         162.653
#> Log-Likelihood Log-Likelihood         -75.185