nt_compare_mg: Compare more than two groups

View source: R/compare_groups.R

nt_compare_mgR Documentation

Compare more than two groups

Description

Performing comparisons among three or more groups.

Usage

nt_compare_mg(
  data,
  group,
  labels = NULL,
  norm.test = helper_sf_test,
  var.test = helper_levene_test,
  qt.test = list(helper_anova, helper_welch_anova, helper_kruskal_wallis),
  contrast = "Tukey",
  alternative = "two.sided",
  format = TRUE,
  digits.p = 3,
  digits.ci = 2,
  save = FALSE,
  file = "nt_compare_mg",
  multiple.comparisons = FALSE
)

Arguments

data

a data frame with the variables.

group

a data frame with the group variable.

labels

a list of labels with components given by their variable names.

norm.test

a function with a numeric vector as input and a list as output containing an object named p.value similar to helper_sf_test.

var.test

a function with a numeric vector, group vector and paired logical variable as input and a list as output containing an object named p.value similar to helper_levene_test.

qt.test

a list of functions for three possible cases: (1) normality and homoscedasticity, (2) normality and heteroscedasticity, (3) non-normality and homoscedasticity/heteroscedasticity.

contrast

a matrix of contrasts. See more details in glht.

alternative

a character value indicating the alternative hypothesis, must be one of "two.sided", "greater" or "less".

format

a logical value indicating whether the output should be formatted.

digits.p

the number of digits to present the p-values.

digits.ci

the number of digits to present the confidence intervals.

save

a logical value indicating whether the output should be saved as a csv file.

file

a character value indicating the name of output file in csv format to be saved.

multiple.comparisons

a logical value indicating if pairwise comparisons should be performed.

Details

If test = "automatic", the normality assumption will be verified by norm.test and homoscedasticity assumption will evaluate the assumption of var.test at a significance level of 0.05. If the data satisfies both assumptions, then qt.test[[1]] is chosen; if only normality is satisfied, then qt.test[[2]]; if only homoscedasticity or neither assumptions, then qt.test[[3]].

Examples

data(iris)

iris |> nt_compare_mg(group = Species)


dnzmarcio/ntimes documentation built on Jan. 4, 2024, 2:23 p.m.