how to fix non-stationarity in a time series ? a primer

how to fix non-stationarity in a time series ? a primer

Time series forms the bread of butter of analysis in most industries and is obviously the stepping stone for data scientists. Having said that this post is aimed basic to intermediate levels ( if you are at an advanced level, feel free to give your comments )

let's get started.

Time series analysis involved an analysis variable with respect to time.. a classic example is stock price.

Stock price at time t - Pt is supposed to be dependent on only the previous stock prices at times t-1 and so on

  • Pt = a * P(t-1) + e(t) ( e is the error at time t )

as you can imagine if a > 1 the price soon explodes hence resulting in non-stationarity

if a is like 0.5 again the price will approach zero , which too is not ideal case. Hence the need for stationarity.

Strict stationarity : the definition of strict stationarity implies mean, variance and co-variance all three don't vary with time.

However in real life, things are not perfect and we never ( mostly ) get strict stationarity. we can only assume trend stationarity ( at the best ).

what happens when we end up getting out-right non-stationarity ? Are our hopes crushed !!

Don't worry , we have variety to tools to our rescue ( although each of them make some assumptions )

Differencing

In this method, we compute the difference of consecutive terms in the series. Differencing is typically performed to get rid of the varying mean. Mathematically, differencing can be written as:

y(t) = y(t) – y(t-1) where y(t) is the value at the time t

Seasonal Differncing

Seasonal differncing follows the same philoshophy of difference however this goes one step further , in here we need to look into the actual seasonal affects on time series data which can be very helpful.

y(t) = y(t) – y(t-n) where n is the length of a season.

Log Transformation

log transformation is required when the time series experiences a exponential growth, for example revenue / stock price of a start-up.

y_new(t) = log(y(t)

log transformation ensures an exponential growth is smoothened, so that we can use normal time series

Combinations

In real life, one would have to use a combination of the above , for example a season diffrencing along with normal differening as most time series in real life is non-stationary for various reasons.




要查看或添加评论,请登录

Krishna Yogi Kolluru的更多文章

社区洞察

其他会员也浏览了