###
Real World use case

As any good pairs trader will tell you, hedge ratios are liable to change over time. One way to combat this problem is to use a rolling window of regressions: i.e. constantly updating your hedge ratio with a trailing window of data. The problem is this method is guaranteed to fail over time as you're always looking **backwards**, averaging what has happened in the past as your best guess of the future hedge ratio.

But a superior method is to employ a dynamic linear model such as the Kalman Filter (KF). The KF is the optimal model for estimating the parameters of linear gaussian models such as pairs trading.