Skip to content

Commit

Permalink
add example to vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 29, 2023
1 parent 7d86627 commit 4618ab7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions vignettes/model_parameters_print.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 4618ab7

Please sign in to comment.