# Non-stationary time series

My current task is to create a machine learning model for time-series forecasting. I have heard that it is very important to understand if your data is an example of stationary time-series or not. People say that without proper dealing with non-stationary time-series data the model's performance could be poor. Can somebody explain to me, please, what is the non-stationary time-series?

Hi @Anna

Non-stationary time-series is a time-series whose major statistical parameters change over time. The mean and standard deviation are examples of such parameters. If your time-series has a trend it is non-stationary, because at least its mean is changing over time. And there could be such time-series which behavior is changing rapidly at certain moments as well. It is especially intrinsic for finance data, for example. Suppose the price for some asset was going up, but then certain event has happened and it pushed the price downwards. This means that the statistical parameters of the price time-series have changed at the moment when the event happened ;) Hope, that helps.

Regards.

How I can check whether the time-series is stationary?

Hello @Anna

I think in real-world most time-series data are non-stationary. They can be stationary only on some relatively short periods. But the statistical and machine learning models work better with stationary data. There are several ways to check stationarity. You can look at plots or calculate statistics for several periods of time and then compare them. A more complex approach is to perform special statistical tests (for example, Dickey-Fuller test).

Regards.

And what I should do if it is non-stationary?

If you have realized that your data is non-stationary you should try to make it stationary. There are a lot of different methods to do this, try to search for them. For example, if you have a time-series with a vivid trend you can fit a regression line to it and then subtract it from the time-series data. This would be equal to removing the trend component from the time-series.

Thank you for the detailed answer!