Source: https://back.nber.org/appendix/w22279/analysis/code/TD/TD.pdf