Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-370

One Way ANOVA F Statistic

Problem

For k groups with n_i observations and grand mean xbar, compute SSB = sum_i n_i (mean_i - xbar)^2 and SSW = sum_i sum_j (x_ij - mean_i)^2, then F = (SSB / (k - 1)) / (SSW / (N - k)) where N is the total count.

Given the list of groups (each a list of values), return F.

Hint

Between-group mean square over within-group mean square.

Test cases

case 1
in: [[[1,2,3],[4,5,6]]]
expected: 13.5
case 2
in: [[[0,1],[2,3]]]
expected: 8
case 3
in: [[[1,2],[3,4],[5,6]]]
expected: 16
Starter codePython
def one_way_anova_f_statistic(groups):
    # Your code here
    pass

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