Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-076

Eta Squared

Problem

Return eta squared SSB / (SSB + SSW), the proportion of total variability explained by group membership. Return 0.0 when there are no values or the total sum of squares is zero.

Hint

It is the ANOVA effect size; 1.0 means groups explain everything.

Test cases

case 1
in: [[[1,2,3],[4,5,6],[7,8,9]]]
expected: 0.9
case 2
in: [[[5,5],[5,5]]]
expected: 0
case 3
in: [[[1,2],[3,4],[5,6]]]
expected: 0.9142857142857143
case 4
in: [[[1],[2],[3]]]
expected: 1
case 5
in: [[]]
expected: 0
Starter codePython
def eta_squared(groups):
    # Your code here
    pass

5 test cases · run your code against them in the editor