Many time series models require stationary data. However, real-world time series data may be non-stationary and heteroscedastic1. Box-cox transformation is useful when reducing the non-stationarity and heteroscedasticity.
Rob J Hyndman and George Athanasopoulos's famous textbook FPP2 provides some nice examples of box-cox transformations.
To see Box-Cox transformation in action, we show an example using the air passenger dataset.
The air passenger dataset is a monthly dataset. We can observe the trend and varying variance simply by eyes.
Applying Box-Cox transformations with different lambdas leads to different results shown below.
To check the variance, we plot out the variance rolling on a 12-month window.
Box-Cox transformation with \(\lambda =0.1\) reduces the variability in variance.
Box-Cox May not Always Reach Perfect Stationary Data
Box-Cox transformation is a simple transformation that helps us reduce the non-stationarity and heteroscedasticy. However, we may not always be able to convert the dataset to stationary and homoscedastic data. This can be observed by performing checks using tools such as
stationarity_tests in Darts.
Homoscedasticity and heteroscedasticity. (2023, June 2). In Wikipedia. https://en.wikipedia.org/wiki/Homoscedasticity_and_heteroscedasticity ↩