Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-318

Quantile Treatment Effect

Problem

Return the quantile treatment effect Q_treated(q) - Q_control(q) using linearly interpolated percentiles at position q*(n-1). Return 0.0 for empty input or q outside [0, 1].

Hint

Compare the two distributions quantile by quantile.

Test cases

case 1
in: [[10,12,14,16],[2,4,6,8],0.5]
expected: 8
case 2
in: [[10,12,14,16],[2,4,6,8],0.25]
expected: 8
case 3
in: [[10,12,14,16],[2,4,6,8],0]
expected: 8
case 4
in: [[5],[1,3,5],0.5]
expected: 2
case 5
in: [[1,2],[3,4],1.5]
expected: 0
Starter codePython
def quantile_treatment_effect(treated_outcomes, control_outcomes, q):
    # Your code here
    pass

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