apa_print.emmGrid {papaja}R Documentation

Typeset Statistical Results from Estimated Marginal Means

Description

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.

Usage

## S3 method for class 'emmGrid'
apa_print(x, infer = TRUE, conf.int = 0.95, ...)

## S3 method for class 'summary_emm'
apa_print(
  x,
  contrast_names = NULL,
  est_name = "\\hat{\\theta}",
  in_paren = FALSE,
  ...
)

## S3 method for class 'lsmobj'
apa_print(x, ...)

## S3 method for class 'summary.ref.grid'
apa_print(x, ...)

Arguments

x

Object

infer

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.

conf.int

Numeric. Confidence level for confidence intervals.

...

Arguments passed on to apa_num

contrast_names

Character. An optional vector of names to label the calculated contrasts.

est_name

Character. If NULL (default) the name of the estimate is inferred from the function call of the model object supplied to emmeans.

in_paren

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.

Details

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").

Value

apa_print()-methods return a named list of class apa_results containing the following elements:

estimate

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.

statistic

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.

full_result

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.

table

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().

See Also

Other apa_print: apa_print.BFBayesFactor(), apa_print.aov(), apa_print.glht(), apa_print.htest(), apa_print.list(), apa_print.lme(), apa_print.lm(), apa_print.merMod(), apa_print()

Examples

  # 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))


[Package papaja version 0.1.2 Index]