Skip to content

Implement Welch's and Brown-Forsythe ANOVA #69

@devcrocod

Description

@devcrocod

Description

Add Welch's ANOVA and Brown-Forsythe ANOVA — robust alternatives to one-way ANOVA when the equal variance assumption is violated (i.e., when Levene's test is significant).

  • Welch's ANOVA — uses weighted group means and Satterthwaite-approximated degrees of freedom
  • Brown-Forsythe ANOVA — similar approach with a different weighting scheme

The existing oneWayAnova() assumes homogeneity of variances. When leveneTest() rejects this assumption, users currently have no robust ANOVA alternative. FDistribution is already available for p-value computation.

Example usage

val groups = arrayOf(groupA, groupB, groupC)

// Check variance homogeneity
val levene = leveneTest(*groups)
if (levene.pValue < 0.05) {
    // Variances unequal — use Welch's ANOVA
    val result = welchAnova(*groups)
    result.statistic  // F statistic
    result.pValue     // significance
}

Related to #62

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions