Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-278

Naive vs Adjusted Difference

Problem

Return [naive, adjusted] as a two-element list, where naive is treated_mean minus control_mean and adjusted additionally removes the piece explained by covariate imbalance: naive - slope*(treated_covariate_mean - control_covariate_mean).

Hint

The adjusted effect subtracts slope times the covariate gap.

Test cases

case 1
in: [12,8,3,2,1.5]
expected: [4,2.5]
case 2
in: [10,10,2,2,3]
expected: [0,0]
case 3
in: [5,6,1,2,-2]
expected: [-1,-3]
case 4
in: [7,7,4,1,0]
expected: [0,0]
Starter codePython
def naive_vs_adjusted(treated_mean, control_mean, treated_covariate_mean, control_covariate_mean, covariate_slope):
    # Your code here
    pass

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