From 4618ab771650a4ce7d43104ac4c9767ca0c161ee Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 29 Sep 2023 09:53:42 +0200 Subject: [PATCH] add example to vignette --- vignettes/model_parameters_print.Rmd | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/vignettes/model_parameters_print.Rmd b/vignettes/model_parameters_print.Rmd index 5a3bcca65..8cae07e29 100644 --- a/vignettes/model_parameters_print.Rmd +++ b/vignettes/model_parameters_print.Rmd @@ -30,16 +30,12 @@ knitr::opts_chunk$set( tidy.opts = list(width.cutoff = 100) ) -pkgs <- c( - "gt", "magrittr", "datawizard", "glmmTMB", "parameters" -) +pkgs <- c("gt", "datawizard", "glmmTMB", "parameters") successfully_loaded <- sapply(pkgs, requireNamespace, quietly = TRUE) if (all(successfully_loaded)) { library(parameters) - library(gt) - library(magrittr) library(datawizard) library(glmmTMB) } @@ -133,6 +129,16 @@ model <- lm(Sepal.Length ~ Species * Petal.Length, data = iris) model_parameters(model, summary = TRUE) ``` +## Including the reference level of categorical variables + +Sometimes, it can be helpful to include the reference level of categorical predictors in the table. This can be done by setting `include_reference = TRUE` in the `print()` method. Since the reference level is not a parameter, it is shown in a separate row, with `0` for the coefficient and blank cells for the remaining columns. + +```{r} +model <- lm(Sepal.Length ~ Petal.Length + Species, data = iris) +mp <- model_parameters(model) +print(mp, include_reference = TRUE) +``` + ## Changing number of digits `digits` changes the digits for coefficients, standard errors and statistics. `ci_digits` and `p_digits` are especially for the confidence intervals and p-values.