Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-371

ANOVA Degrees of Freedom Pair

Problem

In one-way ANOVA the between-groups degrees of freedom is k - 1 and the within-groups degrees of freedom is N - k for k groups and N total observations.

Given k and N, return [df_between, df_within].

Hint

Between uses groups, within uses observations minus groups.

Test cases

case 1
in: [3,30]
expected: [2,27]
case 2
in: [2,20]
expected: [1,18]
case 3
in: [5,50]
expected: [4,45]
Starter codePython
def anova_degrees_of_freedom_pair(k, n_total):
    # Your code here
    pass

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