Takes various emmeans objects to create formatted character strings to report the results in accordance with APA manuscript guidelines. emmeans supports a wide range of analyses, not all of which are currently (fully) supported. Proceed with caution.
# S3 method for emmGrid
apa_print(x, infer = TRUE, conf.int = 0.95, ...)# S3 method for summary_emm
apa_print(
x,
contrast_names = NULL,
est_name = "\\hat{\\theta}",
in_paren = FALSE,
...
)
# S3 method for lsmobj
apa_print(x, ...)
# S3 method for summary.ref.grid
apa_print(x, ...)
apa_print()
-methods return a named list of class apa_results
containing the following elements:
One or more character strings giving point estimates, confidence intervals, and confidence level. A single string is returned in a vector; multiple strings are returned as a named list. If no estimate is available the element is NULL
.
One or more character strings giving the test statistic, parameters (e.g., degrees of freedom), and p-value. A single string is returned in a vector; multiple strings are returned as a named list. If no estimate is available the element is NULL
.
One or more character strings comprised `estimate` and `statistic`. A single string is returned in a vector; multiple strings are returned as a named list.
A data.frame
of class apa_results_table
that contains all elements of estimate
and statistics
. This table can be passed to apa_table()
for reporting.
Column names in apa_results_table
are standardized following the broom glossary (e.g., term
, estimate
conf.int
, statistic
, df
, df.residual
, p.value
). Additionally, each column is labelled (e.g., $\hat{\eta}^2_G$
or $t$
) using the tinylabels package and these labels are used as column names when an apa_results_table
is passed to apa_table()
.
Object
A vector of one or two logical values. The first determines whether confidence intervals are displayed, and the second determines whether t tests and P values are displayed. If only one value is provided, it is used for both.
Numeric. Confidence level for confidence intervals.
Arguments passed on to apa_num.numeric
gt1
Logical. Indicates if the statistic can, in principle, have an
absolute value greater than 1. If FALSE
, leading zeros are
omitted.
zero
Logical. Indicates if the statistic can, in principle, be 0. If
FALSE
, a string of the form < 0.001
is returned instead of 0.
na_string
Character. String to print if any element of x
is NA
.
use_math
Logical. Indicates whether to use $
in the output so that
Inf
or scientific notation is rendered correctly.
add_equals
Logical. Indicates if the output string should be
prepended with an =
.
Character. An optional vector of names to label the calculated contrasts.
Character. If NULL
(default) the name of the estimate
is inferred from the function call of the model object supplied to
emmeans.
Logical. Whether the formatted string is to be reported in
parentheses. If TRUE
, parentheses in the formatted string (e.g., those
enclosing degrees of freedom) are replaced with brackets.
When p-values and confidence intervals are adjusted for multiple testing,
the correction method is added as an index to the output (e.g.
p_{Tukey(3)}
). Values in parenthesis indicate the size of the family of
tests or the rank of the set of linear functions (for the Scheffé method).
If possible, each family of tests is additionally marked in the returned table by alphabetic superscripts.
Generally, the summary_emm
objects returned by emmeans::summary_emm
omit
information that may be needed to add some of the information on the
adjustments made to p-values and confidence intervals. It is therefore
preferable to pass emmGrid
-objects if possible. For example, by using
emmeans(object, 1 ~ x1, adjust = "scheffe")
.
Other apa_print:
apa_print()
,
apa_print.BFBayesFactor()
,
apa_print.aov()
,
apa_print.glht()
,
apa_print.htest()
,
apa_print.list()
,
apa_print.lm()
,
apa_print.lme()
,
apa_print.merMod()
# From the emmeans manual:
library(emmeans)
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
warp.emm <- emmeans(warp.lm, ~ tension | wool)
warp.contr <- contrast(warp.emm, "poly")
apa_print(warp.contr)
# In this example, because degrees of freedom are equal across all rows
# of the output, it is possible to move that information to the variable
# labels. This is useful if a compact results table is required:
df_into_label(apa_print(warp.contr))
Run the code above in your browser using DataLab