onetable {weights} | R Documentation |
Create a clean regression summary table from one or more models
Description
onetable
extracts and formats coefficients, standard errors, p-values, significance stars, and model fit statistics from one or more model objects. It returns a matrix-style table suitable for printing or export. Models may include linear models, generalized linear models, ordinal regressions, mixed-effects models, generalized additive models, penalized regressions, and multinomial regressions.
Usage
onetable(..., digits = 2, p.digits = 3,
fitstats = c("r.squared", "adj.r.squared", "mcfadden", "aic", "n"),
model.names = NULL, collapse = FALSE, formatted = TRUE,
show.cutpoints = TRUE, approx.p = FALSE)
Arguments
... |
One or more fitted model objects. Supported classes include |
digits |
Number of digits to display for estimates and standard errors (default is 2). |
p.digits |
Number of digits to display for p-values (default is 3). |
fitstats |
A character vector of model fit statistics to display. Options include |
model.names |
An optional character vector to name the models in the output. |
collapse |
If |
formatted |
If |
show.cutpoints |
If |
approx.p |
If |
Value
A character matrix with one row per coefficient (and optionally model fit statistics), and one or more columns depending on whether collapse = TRUE
. The object is suitable for display using functions like kable
or export to LaTeX or HTML tables.
See Also
coeffer
, findn
, rd
, pR2
, polr
, multinom
, lmer
, gam
, glmnet
, kable
Examples
data(mtcars)
mod1 <- lm(mpg ~ wt + hp, data = mtcars)
mod2 <- glm(am ~ wt + hp, data = mtcars, family = binomial)
onetable(mod1, mod2)
# Collapsed form
onetable(mod1, mod2, collapse = TRUE)
# Use formatted = FALSE for raw numeric output
onetable(mod1, mod2, formatted = FALSE)
# Add approximate p-values for mixed models
library(lme4)
mod3 <- lmer(Reaction ~ Days + (1 | Subject), data = sleepstudy)
onetable(mod3, approx.p = TRUE)