Skip to content
DeepForgeby svx
All problems
HardStatisticsst-302

RDD Local Linear Estimate

Problem

Return the sharp RDD local linear estimate. Fit separate OLS lines on each side of the cutoff using points within bandwidth (left: cutoff-b <= x < cutoff, right: cutoff <= x <= cutoff+b), evaluate both at the cutoff, and return the right intercept minus the left intercept. Return 0.0 when either side has fewer than two points, bandwidth is not positive, or input is mismatched.

Hint

Extrapolate both fitted lines to the cutoff.

Test cases

case 1
in: [[-2,-1.5,-1,-0.5,0.5,1,1.5,2],[1,2,3,4,7,8,9,10],0,1.5]
expected: 1
case 2
in: [[-2,-1,1,2],[0,1,3,4],0,2]
expected: 0
case 3
in: [[-1,0,1,2],[1,2,3,4],0.5,2]
expected: 0
case 4
in: [[0,1,2],[1,3,5],0,3]
expected: 0
case 5
in: [[-3,-2,-1,1,2,3],[1,2,3,7,8,9],0,3]
expected: 2
Starter codePython
def rdd_local_estimate(running, outcome, cutoff, bandwidth):
    # Your code here
    pass

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