logo

Transformation in Time Series Analysis 📂Statistical Analysis

Transformation in Time Series Analysis

Buildup

The reason why transformations are necessary in time series is to give a “penalty” for increasing variance over time, to keep the variance constant, and to achieve stationarity. The square root $\sqrt{}$ and log $\log$ are often used because the amount reduced is greater for larger values. Of course, when variance decreases, it means that the trend of data converges to some point, thus no time series analysis is needed before the transformation.

Test 1

Box-Cox Transformation: $$g(x) := \begin{cases} \displaystyle {{ x^{\lambda} - 1 } \over { \lambda }} & , \lambda \ne 0 \\ \log x & , \lambda = 0 \end{cases}$$

When it is not clear just by looking whether to take a transformation or which transformation is appropriate, we usually use the hypothesis test of Box-Cox transformation, which can also be used to justify why no further transformation is needed.

Practice

Let’s load the built-in data, UKgas.

20190303\_121926.png

UKgas.png

UKgas is data recorded quarterly on the consumption of gas in the UK, and as you can see, the fluctuations become more severe as the years go by. In such cases of non-constant variance, it is difficult to conduct a smooth analysis. Therefore, making the data easier to handle by taking transformations like logs is essential.

20190303\_121915.png

logUKgas.png

Taking a transformation, we can see that the variance has noticeably become more uniform, though not perfect.

Code

Below is an example code.

UKgas
win.graph(4,4); plot(UKgas,main='UKgas')
log(UKgas)
win.graph(4,4); plot(log(UKgas),main='log(UKgas)')

See Also


  1. Cryer. (2008). Time Series Analysis: With Applications in R(2nd Edition): p101. ↩︎