Skip to contents

Performs Dunn's multiple comparison test for comparing treatment groups against a control after a significant Kruskal-Wallis test. This is a wrapper around PMCMRplus::kwManyOneDunnTest that provides consistent output structure with other drcHelper test functions.

Usage

dunn_test(
  data,
  response_var,
  dose_var,
  control_level = 0,
  alternative = "less",
  p_adjust_method = "holm",
  alpha = 0.05,
  include_kruskal = TRUE
)

Arguments

data

A data frame containing the response and grouping variables

response_var

Character string specifying the name of the response variable

dose_var

Character string specifying the name of the dose/treatment variable

control_level

The control level (default: 0)

alternative

Character string specifying the alternative hypothesis. Must be one of "less", "greater", or "two.sided" (default: "less")

p_adjust_method

Character string specifying the p-value adjustment method (default: "holm"). See p.adjust.methods for available methods

alpha

Significance level (default: 0.05)

include_kruskal

Logical indicating whether to include Kruskal-Wallis test results (default: TRUE)

Value

A list of class "dunn_test_result" containing:

results_table

Data frame with comparison results including z-values and p-values

kruskal_wallis

Kruskal-Wallis test results (if include_kruskal = TRUE)

noec

No Observed Effect Concentration

noec_message

Description of NOEC determination

model_type

Description of the statistical method used

control_level

The control level used

alpha

Significance level used

alternative

Alternative hypothesis tested

p_adjust_method

P-value adjustment method used

Note

This function uses PMCMRplus::kwManyOneDunnTest which produces equivalent results to DescTools::DunnTest. Both implementations use the same underlying statistical methodology for Dunn's post-hoc test following Kruskal-Wallis.

Examples

if (FALSE) { # \dontrun{
# Example data
Rate <- c(0,0,0,0,0,0,
          0.0448,0.0448,0.0448,0.0448,
          0.132,0.132,0.132,0.132)
y <- c(0.131,0.117,0.130,0.122,0.127,0.128,
       0.122,0.126,0.128,0.116,
       0.090,0.102,0.107,0.099)
test_data <- data.frame(Rate = Rate, Response = y)

# Run Dunn's test
result <- dunn_test(test_data, response_var = "Response", 
                    dose_var = "Rate", control_level = 0, 
                    alternative = "less")
} # }