View source: R/format_parameters.R
format_parameters | R Documentation |
This functions formats the names of model parameters (coefficients) to make them more human-readable.
format_parameters(model, ...)
## Default S3 method:
format_parameters(model, brackets = c("[", "]"), ...)
model |
A statistical model. |
... |
Currently not used. |
brackets |
A character vector of length two, indicating the opening and closing brackets. |
A (names) character vector with formatted parameter names. The value names refer to the original names of the coefficients.
Note that the interpretation of interaction terms depends on many
characteristics of the model. The number of parameters, and overall
performance of the model, can differ or not between a * b
,
a : b
, and a / b
, suggesting that sometimes interaction terms
give different parameterizations of the same model, but other times it gives
completely different models (depending on a
or b
being factors
of covariates, included as main effects or not, etc.). Their interpretation
depends of the full context of the model, which should not be inferred
from the parameters table alone - rather, we recommend to use packages
that calculate estimated marginal means or marginal effects, such as
modelbased, emmeans, ggeffects, or
marginaleffects. To raise awareness for this issue, you may use
print(...,show_formula=TRUE)
to add the model-specification to the output
of the print()
method for model_parameters()
.
model <- lm(Sepal.Length ~ Species * Sepal.Width, data = iris)
format_parameters(model)
model <- lm(Sepal.Length ~ Petal.Length + (Species / Sepal.Width), data = iris)
format_parameters(model)
model <- lm(Sepal.Length ~ Species + poly(Sepal.Width, 2), data = iris)
format_parameters(model)
model <- lm(Sepal.Length ~ Species + poly(Sepal.Width, 2, raw = TRUE), data = iris)
format_parameters(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.