modelsummary (version 0.3.0)

extract_estimates: Extract estimates and statistics from a single model

Description

Extract estimates and statistics from a single model

Usage

extract_estimates(
  model,
  statistic = "std.error",
  statistic_override = NULL,
  statistic_vertical = TRUE,
  conf_level = 0.95,
  fmt = "%.3f",
  stars = FALSE,
  ...
)

Arguments

model

object type with an available `tidy` method.

statistic

string name of the statistic to include in parentheses

  • Typical values: "conf.int", "std.error", "statistic", "p.value"

  • Alternative values: any column name produced by `broom::tidy(model)`

statistic_override

manually override the uncertainy estimates. This argument accepts three types of input:

  • a function or list of functions of length(models) which produce variance-covariance matrices with row and column names equal to the names of your coefficient estimates. For example, `R` supplies the `vcov` function, and the `sandwich` package supplies `vcovHC`, `vcovHAC`, etc.

  • a list of length(models) variance-covariance matrices with row and column names equal to the names of your coefficient estimates.

  • a list of length(models) vectors with names equal to the names of your coefficient estimates. Numeric vectors are formatted according to `fmt` and placed in brackets, character vectors printed as given.

statistic_vertical

TRUE if statistics should be printed below estimates. FALSE if statistics should be printed beside estimates.

conf_level

confidence level to use for confidence intervals

fmt

string which specifies how numeric values will be rounded. This string is passed to the `sprintf` function. '%.3f' will keep 3 digits after the decimal point with trailing zero. '%.5f' will keep 5 digits. '%.3e' will use exponential notation. See `?sprintf` for more options.

stars

to indicate statistical significance

  • FALSE (default): no significance stars.

  • TRUE: *=.1, **=.05, ***=.01

  • Named numeric vector for custom stars such as `c('*' = .1, '+' = .05)`

...

all other arguments are passed to the `tidy` method used to extract estimates from the model. For example, this allows users to set `exponentiate=TRUE` to exponentiate logistic regression coefficients.

Value

data.frame with side-by-side model summaries