Skip to content
DeepForgeby svx
All problems
EasyOptimizationop-101

Factorial Effect Estimate 2x2

Problem

Estimate main effects and the interaction from a 2x2 factorial design.

With y00, y01, y10, y11 the responses for (A low, B low) through (A high, B high), main_a = mean of the A-high runs minus the A-low runs, main_b is the same for B, and the interaction is (y11 - y10) - (y01 - y00). Return [main_a, main_b, inter].

Hint

The interaction is the difference of the B effects at the two A levels.

Test cases

case 1
in: [1,2,3,4]
expected: [2,1,0]
case 2
in: [5,3,2,6]
expected: [0,1,6]
case 3
in: [0,0,0,1]
expected: [0.5,0.5,1]
Starter codePython
def factorial_effect_2x2(y00, y01, y10, y11):
    # Returns [main_a, main_b, inter]
    # Your code here
    pass

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