View the model
Download the model
Given a series of observations, we want to employ a piecewise linear filter. Although the estimation is similar to that of Hodrick-Prescott (HP) filter, which is basically a L2 filter, the main difference is that penalty parameter lambda here does not determine the smoothness, but the number of breaks.
This is a good example of the use of linearization, which is useful in handling the non-smooth ABS() functions.