imed_stats: Conservative inferential statistics

View source: R/statistics.R

imed_statsR Documentation

Conservative inferential statistics

Description

Tests are explicit, never auto-selected from p-values or normality alone.

Usage

imed_stats(
  x,
  value = "Mean",
  group = NULL,
  test = c("none", "welch", "wilcoxon", "kruskal")
)

Arguments

x

An 'imed_db', or a measurement-level data frame such as the output of 'imed_analysis_set()'. The comparability guard is applied, so the records must belong to one compatible comparability class.

value

Name of the numeric measurement field to analyse (default '"Mean"').

group

Grouping field (unquoted or quoted name); required when 'test' is not '"none"'.

test

Test to run: '"none"' (default), '"welch"', '"wilcoxon"' or '"kruskal"'. The test is never chosen automatically.

Value

An object of class 'c("imed_stats", "list")' with the elements 'descriptive' (a 'tibble' from 'imed_describe()'), 'normality' (a 'tibble' with the Shapiro-Wilk test, present when 3 to 5000 finite values are available) and 'test' (a 'tibble' with 'method', 'statistic' and 'p_value', present when 'test' is not '"none"').

Examples

toy <- data.frame(
  Study_ID = paste0("S", 1:12),
  Comparability_Class = "CLASS_A",
  Reported_Unit = "items/L",
  Metric_Type = "Abundance",
  Strict_Synthesis_Eligibility = "YES",
  Group = rep(c("g1", "g2"), 6),
  Mean = c(2.1, 3.4, 1.8, 4.0, 2.9, 3.1, 2.4, 3.8, 1.9, 3.3, 2.7, 4.2),
  SD = rep(c(0.6, 0.9), 6),
  N = rep(c(10, 12, 8), 4)
)
imed_stats(toy, group = "Group", test = "welch")

imedR documentation built on Nov. 3, 2026, 5:08 p.m.