This function takes a data frame, typically a data frame with information on
summaries of model parameters like bayestestR::describe_posterior()
,
bayestestR::hdi()
or parameters::model_parameters()
, as input and splits
this information into several parts, depending on the model. See details
below.
print_parameters(
x,
...,
by = c("Effects", "Component", "Group", "Response"),
format = "text",
parameter_column = "Parameter",
keep_parameter_column = TRUE,
remove_empty_column = FALSE,
titles = NULL,
subtitles = NULL
)
A data frame or a list of data frames (if by
is not NULL
). If a
list is returned, the element names reflect the model components where the
extracted information in the data frames belong to, e.g.
random.zero_inflated.Intercept: persons
. This is the data frame that
contains the parameters for the random effects from group-level "persons"
from the zero-inflated model component.
A fitted model, or a data frame returned by clean_parameters()
.
One or more objects (data frames), which contain information about the model parameters and related statistics (like confidence intervals, HDI, ROPE, ...).
by
should be a character vector with one or more of the following
elements: "Effects"
, "Component"
, "Response"
and "Group"
. These are
the column names returned by clean_parameters()
, which is used to extract
the information from which the group or component model parameters belong.
If NULL
, the merged data frame is returned. Else, the data frame is split
into a list, split by the values from those columns defined in by
.
Name of output-format, as string. If NULL
(or "text"
),
assumed use for output is basic printing. If "markdown"
, markdown-format
is assumed. This only affects the style of title- and table-caption
attributes, which are used in export_table()
.
String, name of the column that contains the
parameter names. Usually, for data frames returned by functions the
easystats-packages, this will be "Parameter"
.
Logical, if TRUE
, the data frames in the
returned list have both a "Cleaned_Parameter"
and "Parameter"
column. If FALSE
, the (unformatted) "Parameter"
is removed,
and the column with cleaned parameter names ("Cleaned_Parameter"
) is
renamed into "Parameter"
.
Logical, if TRUE
, columns with completely
empty character values will be removed.
By default, the names of the model components (like
fixed or random effects, count or zero-inflated model part) are added as
attributes "table_title"
and "table_subtitle"
to each list
element returned by print_parameters()
. These attributes are then
extracted and used as table (sub) titles in export_table()
.
Use titles
and subtitles
to override the default attribute
values for "table_title"
and "table_subtitle"
. titles
and subtitles
may be any length from 1 to same length as returned
list elements. If titles
and subtitles
are shorter than
existing elements, only the first default attributes are overwritten.
This function prepares data frames that contain information about model parameters for clear printing.
First, x
is required, which should either be a model object or a
prepared data frame as returned by clean_parameters()
. If
x
is a model, clean_parameters()
is called on that model
object to get information with which model components the parameters
are associated.
Then, ...
take one or more data frames that also contain information
about parameters from the same model, but also have additional information
provided by other methods. For instance, a data frame in ...
might
be the result of, for instance, bayestestR::describe_posterior()
,
or parameters::model_parameters()
, where we have a) a
Parameter
column and b) columns with other parameter values (like
CI, HDI, test statistic, etc.).
Now we have a data frame with model parameters and information about the
association to the different model components, a data frame with model
parameters, and some summary statistics. print_parameters()
then merges
these data frames, so the parameters or statistics of interest are also
associated with the different model components. The data frame is split into
a list, so for a clear printing. Users can loop over this list and print each
component for a better overview. Further, parameter names are "cleaned", if
necessary, also for a cleaner print. See also 'Examples'.