Passer au contenu

This function performs an ANOVA or Kruskal-Wallis test depending on the assumptions of normality and homoscedasticity. It then returns a summary of statistical groups using a post-hoc SNK test (for ANOVA) or Kruskal-Conover test.

Utilisation

test_stats(
  self,
  prep_data = NULL,
  fcol = NULL,
  block = FALSE,
  alpha = 0.05,
  p.adj = "bonferroni",
  force_test = NULL
)

Arguments

self

An instance of the UserData R6 class containing metadata$moda_desc

prep_data

character, the name of a dataframe inside self$prepared_data.

fcol

col name as factor. NULL by default, if not provided xp_trt_name or xp_trt_code is used

block

colname to use as block. if FALSE : no block factor tested. if TRUE : "block_code" is used. if value : value is used

alpha

Significance threshold (default = 0.05).

p.adj

Method for adjusting p values. see agricolae::LSD.test(). “none”, “holm”, “hommel”, “hochberg”, “bonferroni”, “BH”, “BY”, “fdr”

force_test

Force "anova" or "kruskal" (bypass assumptions).

Valeur de retour

A list with test name, p-value and group letters.

Détails

If xp _trt_code is not provided, it is inferred from the plot_id column: numeric plot codes are extracted from the beginning of the string (e.g. "10A" to 10), and "TNT" is used directly for untreated control plots.

Group comparison is only meaningful if the global test (ANOVA or Kruskal-Wallis) is statistically significant.