python-causality-handbook
python-causality-handbook copied to clipboard
Chapter 19 - Sensitivity by Model Band
Hi, I have a question on the Sensitivity by Model Band section of Chapter 19.
Why do we compute the sensitivity for each band like this using a single variable linear regression model?
@curry
def sensitivity(data, y, t):
# line coeficient for the one variable linear regression
return (np.sum((data[t] - data[t].mean())*(data[y] - data[y].mean())) /
np.sum((data[t] - data[t].mean())**2))
I am struggling to understand why this model is used here, while a few cells above we are computing the sensitivity differently using (y(t+h) - y(t)) / h with OLS with interaction terms. For instance, couldn't why compute the mean of the sensitivity we already have for each band?
Thanks