8/36
Part 2 of 6 · The estimateLearn

The estimate is the treated group's change minus the control group's change

Subtract one easy answer's bias, and the estimate is left.

def did_estimate(y, treated, post):
    y, treated, post = (np.asarray(a, float)
                        for a in (y, treated, post))

    def mean(t, p):
        return y[(treated == t) & (post == p)].mean()

    treated_change = mean(1, 1) - mean(1, 0)
    control_change = mean(0, 1) - mean(0, 0)
    return float(treated_change - control_change)

print(did_estimate(*worked_example()[:3]))
print(round(did_estimate(*panel()[:3]), 2))
Predict

The practice panel was built with a true effect of 2. About what does did_estimate return?

Pick one to see what it prints.
Pick an answer above to see the rest