I am trying to build a time series model. But I am getting a non dying acf curve. This means my series is not stationary. Can anyone help me with techniques to bring stability in a time series

# What are the ways through which we can make a time series stationary

**kunal**#2

Alex,

The two most common ways to make a non-stationary time series curve stationary are:

- Differencing
- Transforming

Let us look at some details for each of them:

##
**Differencing**:

In order to make your series stationary, you take a difference between the data points. So let us say, your original time series was:

```
X1, X2, X3,...........Xn
```

You series with difference of degree 1 becomes:

```
(X2 - X1, X3 - X2, X4 - X3,.......Xn - X(n-1)
```

Once, you take the difference, plot the series and see if there is any improvement in the the acf curve. If not, you can try a second or even a third order differencing. Remember, the more you difference, the more complicated your analysis is becoming.

## Transformation

If you can not make a time series stationary, you can try out transforming the variables. Log transform is probably the most commonly used transformation, if you are seeing a diverging time series.

However, it is normally suggested that you use transformation only in case differencing is not working.

Hope this gives you a good overview of ways to make time series stationary.

Regards,

Kunal

**azimulh**#3

What if none of the methods are working? i am facing such a situation.

Differencing: plot(diff(value))

Log transformation: plot(diff(log(val.ts)))

Now what to do! This is a challenge i am currently trying to solve. Any help will be appreciated.

**azimulh**#5

Thanks Kunal. I tried that and it works like a charm. This has one issue though, which is how o find the actual fitted value from double differenced series?

diff() once. yellow is diff() of original values. blue is fitted value in diff() format.

**azimulh**#6

diff(diff()) i.e. twice. yellow is diff() of original values twice. blue is fitted value in diff() format twice.

Now there is a challenge. How do i find actual fitted value from these fitted values which appear in double differenced format? Challenge is same even for single differencing. If you know the first value in actual fitted value you can use differenced fitted values to find the series. However there is no way available to find it!

**kunal**#7

@azimuth,

Once you know the differenced time series, you can reconstruct the original back, as you would have last values from actual data.

For double differenced series, you will need to just do it twice.

Should be simple.

Regards,

Kunal

**azimulh**#8

Hi Kunal, it gives me negative numbers. I have sales forecasting data. It just canno be negative. I do not have rights to add all those screenshots with results.

I have actually added everything here.

Convert double differenced forecast into actual value

**azimulh**#9

well, i found the answer. This is possible through auto.arima d parameter. Its in the link i have posted

**asmit_123**#10

Hi Friends,

Just wanted to have your thoughts on how you would make series stationary with hardly 15-16 data points.

Also, if I end up differencing the series, I end up losing data points.

Any thoughts on this ?

**gurchetan1000**#11

It is indeed a very small dataset to make any kind of forecasting. Try increasing your dataset as you can’t find any significant information from such a small dataset.

**AishwaryaSingh**#12

I understand that there are broadly two methods of making series stationary : Differencing and transforming. One of the methods of transforming series is Box - Cox Transform.

Box - cox takes lambda as input, the value of which varies from -5 to 5. How can one decide the best lambda value?