multiple: Multiple comparisons with plot.

View source: R/plot_functions.R

multipleR Documentation

Multiple comparisons with plot.

Description

multiple displays results from post-doc analysis and constructs corresponding plot.

Usage

multiple(
  model,
  formula,
  adjust = "mvt",
  type = "response",
  reverse = TRUE,
  level = 0.95,
  digits = 2,
  ...
)

Arguments

model

A fitted model supported by emmeans, such as the result of a call to aov, lm, glm, etc.

formula

A formula with shape: ~ y or ~ y|x (for interactions). Where y is the term of the model on which comparisons are made and x is a term interacting with y.

adjust

Method to adjust CIs and p-values (see details).

type

Type of prediction (matching "linear.predictor", "link", or "response").

reverse

Logical argument. Determines the direction of comparisons.

level

Confidence interval significance level.

digits

Number of digits for rounding (default = 2).

...

Further arguments passed to emmeans.

Details

The default adjusting method is "mvt" which uses the multivariate t distribution. Other options are: "bonferroni", "holm", "hochberg", "tukey" and "none". The default option for argument reverse is to make reverse comparisons, i.e., against the reference level matching comparisons from lm and glm.

Value

A list with objects: df A data frame with adjusted p-values, fig_ci a plot with estimates and adjusted confidence intervals and fig_pval a plot comparing adjusted p-values.

See Also

emmeans, pwpp.

Examples

data(birthwt, package = "MASS")
birthwt$race <- factor(birthwt$race, labels = c("White", "African American", "Other"))

model_1 <- aov(bwt ~ race, data = birthwt)
multiple(model_1, ~race)$df

multiple(model_1, ~race)$fig_ci |>
  gf_labs(y = "Race", x = "Difference in birth weights (g)")

multiple(model_1, ~race)$fig_pval |>
  gf_labs(y = "Race")

pubh documentation built on Oct. 8, 2024, 9:08 a.m.