Skip to content

Implement Scheffé's post-hoc test for arbitrary contrasts #67

@devcrocod

Description

@devcrocod

Description

Add Scheffé's post-hoc test for comparisons after ANOVA. Unlike Tukey HSD (#39) which handles only pairwise comparisons, Scheffé's test supports arbitrary linear contrasts — weighted combinations of group means.

Uses the F-distribution for critical values. The test is more conservative than Tukey for pairwise comparisons, but uniquely handles complex contrasts like "group A vs average of groups B and C". All prerequisites exist: oneWayAnova() exposes msWithin, dfBetween, dfWithin in AnovaResult, and FDistribution is available in kstats-distributions.

Example usage

val groups = arrayOf(groupA, groupB, groupC, groupD)
val anova = oneWayAnova(*groups)

// Arbitrary contrast: group A vs average of B, C, D
val result = scheffeTest(groups, contrasts = doubleArrayOf(1.0, -1/3.0, -1/3.0, -1/3.0))
result.statistic  // F statistic for the contrast
result.pValue     // significance

Related to #39, #41, #62

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions