[Stable]
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"
)

Arguments

model

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()

digits

number of digits to round to

assumption_plot

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().

quite

suppress printing output

streamline

print streamlined output. Only print model estimate and performance.

return_result

It set to TRUE, it return the model estimates data frame.

standardize

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()

ci_method

see options in the Mixed model section in ?parameters::model_parameters()

Value

a list of model estimate data frame, model performance data frame, and the assumption plot (an ggplot object)

References

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

Examples

# 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
)

model_summary(lme_fit)
#> 
#>  
#> Model Summary
#> Model Type = Linear Mixed Effect Model (fitted using lme4 or lmerTest)
#> Outcome = popular
#> Predictors = texp
#> 
#> Model Estimates
#> ─────────────────────────────────────────────────────────────────────────────────────────────────────
#>           Parameter  Coefficient     SE       t      df  Effects     Group          p          95% CI
#> ─────────────────────────────────────────────────────────────────────────────────────────────────────
#>         (Intercept)        4.197  0.186  22.552  97.989    fixed            0.000 ***  [3.827, 4.566]
#>                texp        0.062  0.012   5.212  98.105    fixed            0.000 ***  [0.038, 0.085]
#>      SD (Intercept)        0.737    NaN     NaN     NaN   random     class    NaN          [NaN, NaN]
#>   SD (Observations)        1.105    NaN     NaN     NaN   random  Residual    NaN          [NaN, NaN]
#> ─────────────────────────────────────────────────────────────────────────────────────────────────────
#> *** p < 0.001, ** p < 0.01, * p < 0.05, + p < 0.1
#> You can drag and resize the R console to view the entire table
#> 
#> Goodness of Fit
#> ────────────────────────────────────────────────────────────────────────────────
#>        AIC      AICc       BIC  R²_conditional  R²_marginal    ICC   RMSE      σ
#> ────────────────────────────────────────────────────────────────────────────────
#>   6321.320  6321.340  6343.724           0.366        0.085  0.308  1.080  1.105
#> ────────────────────────────────────────────────────────────────────────────────
#> 

# 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
#> ──────────────────────────────────────────────────────────
#>