# How do I forecast time series for which the range of residuals is increasing over time?

I have gathered 25 years worth of monthly timeseries data.

The value of Y (dependent variable) has seasonality of 10 months. I have used polynomial equation to model seasonality cycle. The trend is growing which I am using best fit line to forecast.

Finally,

I am calculating residual:

Residual = Y/(trend x seasonality) for each month

However as I move on in time, the range of residuals increase. For example, residual at month 1 is 100 and for the first year, it remains within 50-300. In year 25 month 1, it is 3560. And it remains within 50-4500 for the year 25. This is a much higher range.

I am new to times series analysis and wanted to know how do I model this increase in values?

Is there a name of this type of timeseries issue?

I am using python. Please suggest any pointers.

• Is the response necessarily positive (or at least non-negative)? Is it continuous or discrete? Dec 27 '18 at 2:20

Following up on @ColorStatistics excellent advice....

This post Variance inhomogeneity in time series when forecasting should be of interest to you . Note that the fact that the observed series may have increasing variability does not mean that the error variance from a reasonable model will also exhibit the characteristic. Take a look at https://autobox.com/cms/index.php/blog/entry/u-didnt-need-logs as to how a cursory examination about variability can often be flawed.

• Thank you, IrishStat. Regarding the second link you quote, it wasn't clear to me what their conclusion is. Are they saying that in the presence of outliers taking logarithms of a series as a way to stabilize the variance is inappropriate, but in the absence of outliers - that it is appropriate? That is my reading of it. Dec 26 '18 at 19:21
• what i was trying to point out was that outliers can falsely suggest the need for a transform. Building a fairly simple SARIMA model on the original data with 2 outliers is sufficient to obtain constant error variance. Since the two outliers were at the high level of the series their presence falsely suggests higher variance at the higher level. see autobox.com/pdfs/vegas_ibf_09a.pdf for more details on this. Dec 26 '18 at 20:13
• To be clear, are we suggesting that I should follow these steps: 1. Transform Y to log(Y). 2. Compute trend and seasonality of log(Y) 3. Do residual = log(Y) /(seasonality x trend of log Y) Dec 26 '18 at 23:34
• No only transform if stats.stackexchange.com/questions/18844/… . Build and identify an ARIMA model on the original series and incorporate deterministic structure as discussed here docplayer.net/… Dec 27 '18 at 2:25
• I read the link. Taking log makes sense because I want to penalise larger values and get linear transform. But I still dont know how it will work with multiple variables. I have 20+ independent variables. One variable captures trend and one captures seasonality. I am unsure how I can use Arima there. I am using regression to forecast using these 22 independent variables. Dec 27 '18 at 8:55

When the range of the residuals - as you saw it, or to use another measure of spread, the variance of residuals - changes over time, this is a symptom that goes by the name of heteroskedasticity, from the Greek root words of "hetero" for different and "skedasis" for dispersion or spread. In a cross section, this would be the end of the diagnosis.

In a time series context, however, this is only a symptom of a potentially deeper, underlying condition - lack of covariance stationarity (alternatively expressed - lack of weak stationarity). This is evidenced by the fact that the autocovariance function in your case is a function of time. However, this conclusion isn't completely foolproof because stationarity or lack of it is a condition of the underlying stochastic process and not of the single realization you observed (i.e. the sample that you have collected). In other words, the stochastic process that has produced this series may be stationary but you may have had the bad luck of observing/collecting a very unrepresentative realization/sample. But chances are that if your realization is not stationary then the underlying stochastic process is not stationary.

Lack of (weak) stationarity isn't a death sentence for your series, by any means, but it is a condition that will require some special attention. The presence/lack of stationarity is very informative as to your potential next steps in modelling this series.

Read up on stationarity, transformations of non-stationary series into stationary (concept of "integrated" series), ARMA and ARIMA modelling. This site can guide you well in this journey... just do some searches for some of those keyterms.

• Thank you. This is very useful. I understand that the series is not covariance stationary because its mean and variance are changing. I also understand that there is seasonality and trend and I could find the terms, perform differencing and use Arima models. However my forecasted line of the resduals does not have as high variance as the actual residuals. Can you suggest any technique on reducing residuals variance or seasonality amplitude? Thank you Dec 26 '18 at 18:05
• Logarithmic transformations may help stabilize the variance of a time series. Dec 26 '18 at 18:12
• sometimes non-constant variance is caused by a deterministic change in the error variance as discussed here docplayer.net/… Dec 27 '18 at 2:26
• @colorstatistics can i use arima with ols multiple regression Jan 6 '19 at 23:22