20/36
Part 4 of 6 · RegressionLearn and do

The regression gives the same number, plus a standard error

A standard error needs the estimate written as a regression.

y, treated, post, week = worked_example()
X = np.column_stack([np.ones_like(y), treated, post, treated * post])
alpha, beta, gamma, delta = np.linalg.lstsq(X, y, rcond=None)[0]
print(f"alpha {alpha:.2f}  beta {beta:.2f}  "
      f"gamma {gamma:.2f}  delta {delta:.2f}")

y, treated, post, week = panel(1)
X = np.column_stack([np.ones_like(y), treated, post, treated * post])
delta = np.linalg.lstsq(X, y, rcond=None)[0][3]
did = did_estimate(y, treated, post)
print(f"delta {delta:.6f}   did_estimate {did:.6f}   "
      f"apart by {abs(delta - did):.0e}")
Predict

Regress y on an intercept, treated, post and treated × post. The interaction's coefficient equals what?

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