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 Feb. 5, 2025, 8:57 a.m.