Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-104

DOE Main Effect

Problem

Estimate the main effect of a two-level factor from experimental data.

Return mean(response at level 1) - mean(response at level 0). If one of the levels never appears, return 0.0.

Hint

The main effect is a difference of group means.

Test cases

case 1
in: [[0,0,1,1],[1,2,3,5]]
expected: 2.5
case 2
in: [[1,0,1,0],[4,1,6,3]]
expected: 3
case 3
in: [[0,0],[2,4]]
expected: 0
case 4
in: [[1,1],[2,4]]
expected: 0
Starter codePython
def doe_main_effect(levels, responses):
    # Your code here
    pass

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