What's the best way to implement an autoregressive moving average of a time series with a variable lag and window size?

People frequently ask about this, and I really don’t think it’s necessary. Just put a regularizing prior on your coefficient matrix. There’s no difference between a huge elaborate model that has dynamic shapes, and one that simply puts a zero in front of lags it judges unnecessary.