In its simplest terms, imagine you were just using the yield curve as your single predictor of recessions. Suppose (horribly simplistically) that curve inversions tend to signal downturns in 12-18 months time. The curve 12-18 months ago is thus a relevant variable for whether the economy is going into recession or not today.
It might also be the case that ...
I know this is an old question, but I wanted to add that the NPM library technialinidicators, while advertised for crypto markets, has open code for many popular and some obscure technical indicators. I've hand written a few indicators from scratch, too, after finding performance issues in that library. But it's a useful reference.
It is an old thread. Just pointing out that capability is available in ARCH package now for the benefit of future readers.