Skip to contents

Produces a formatted regression table comparing multiple causal inference estimates, suitable for journal submission. Supports HTML, LaTeX, and plain text output via modelsummary or a built-in fallback.

Usage

causal_table(
  models,
  coef_map = NULL,
  gof_rows = c("nobs", "r.squared", "adj.r.squared"),
  title = "Causal Inference Results",
  notes = NULL,
  stars = c(`*` = 0.1, `**` = 0.05, `***` = 0.01),
  output_format = c("html", "latex", "dataframe"),
  digits = 3
)

Arguments

models

Named list of model objects or tidy data frames (from tidy_causal()).

coef_map

Named character vector. Mapping from coefficient names to display names. E.g., c(treat = "Treatment", age = "Age").

gof_rows

Character vector. Goodness-of-fit statistics to include. Default c("nobs", "r.squared", "adj.r.squared").

title

Character. Table title.

notes

Character or NULL. Table footnote.

stars

Logical or named numeric vector. Significance thresholds. Default c("*" = 0.1, "**" = 0.05, "***" = 0.01).

output_format

Character. "html" (default), "latex", or "dataframe".

digits

Integer. Decimal places. Default 3.

Value

A modelsummary table, gt table, or data frame.

Examples

if (FALSE) { # \dontrun{
m1 <- lm(mpg ~ am, data = mtcars)
m2 <- lm(mpg ~ am + wt, data = mtcars)
m3 <- lm(mpg ~ am + wt + hp, data = mtcars)

causal_table(
  models   = list("(1) Bivariate" = m1, "(2) + Weight" = m2,
                  "(3) Full" = m3),
  coef_map = c(am = "Manual Transmission", wt = "Weight (1000 lbs)",
               hp = "Horsepower"),
  title    = "Effect of Transmission Type on MPG"
)
} # }