The function will extract the relevant coefficients from the regression models (see below for supported model).
model_summary(
model,
digits = 3,
assumption_plot = FALSE,
quite = FALSE,
streamline = TRUE,
return_result = FALSE,
standardize = NULL,
ci_method = "satterthwaite"
)
an model object. The following model are tested for accuracy: lm
, glm
, lme
, lmer
, glmer
. Other model object may work if it work with parameters::model_parameters()
number of digits to round to
Generate an panel of plots that check major assumptions. It is usually recommended to inspect model assumption violation visually. In the background, it calls performance::check_model()
.
suppress printing output
print streamlined output. Only print model estimate and performance.
It set to TRUE
, it return the model estimates data frame.
The method used for standardizing the parameters. Can be NULL (default; no standardization), "refit" (for re-fitting the model on standardized data) or one of "basic", "posthoc", "smart", "pseudo". See 'Details' in parameters::standardize_parameters()
see options in the Mixed model
section in ?parameters::model_parameters()
a list of model estimate data frame, model performance data frame, and the assumption plot (an ggplot
object)
Nakagawa, S., & Schielzeth, H. (2013). A general and simple method for obtaining R2 from generalized linear mixed-effects models. Methods in Ecology and Evolution, 4(2), 133–142. https://doi.org/10.1111/j.2041-210x.2012.00261.x
# I am going to show the more generic usage of this function
# You can also use this package's built in function to fit the models
# I recommend using the integrated_multilevel_model_summary to get everything
# lme example
lme_fit <- lme4::lmer("popular ~ texp + (1 | class)",
data = popular
)
#> Error in initializePtr(): function 'cholmod_factor_ldetA' not provided by package 'Matrix'
model_summary(lme_fit)
#> Error in eval(expr, envir, enclos): object 'lme_fit' not found
# lm example
lm_fit <- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width,
data = iris
)
model_summary(lm_fit)
#>
#>
#> Model Summary
#> Model Type = Linear regression
#> Outcome = Sepal.Length
#> Predictors = Sepal.Width, Petal.Length, Petal.Width
#>
#> Model Estimates
#> ────────────────────────────────────────────────────────────────────────────
#> Parameter Coefficient SE t df p 95% CI
#> ────────────────────────────────────────────────────────────────────────────
#> (Intercept) 1.856 0.251 7.401 146 0.000 *** [ 1.360, 2.352]
#> Sepal.Width 0.651 0.067 9.765 146 0.000 *** [ 0.519, 0.783]
#> Petal.Length 0.709 0.057 12.502 146 0.000 *** [ 0.597, 0.821]
#> Petal.Width -0.556 0.128 -4.363 146 0.000 *** [-0.809, -0.304]
#> ────────────────────────────────────────────────────────────────────────────
#> *** p < 0.001, ** p < 0.01, * p < 0.05, . p < 0.1
#>
#> Goodness of Fit
#> ──────────────────────────────────────────────────────────
#> AIC AICc BIC R² R²_adjusted RMSE σ
#> ──────────────────────────────────────────────────────────
#> 84.643 85.059 99.696 0.859 0.856 0.310 0.315
#> ──────────────────────────────────────────────────────────
#>