A unified approach to nonlinearity, structural change, and outliers