# Why do sample ACF/PACF suggest different TS models after box-cox transformation?

I use auto.arima function in R to fit a TS model to a annual data composed of electricity demand. The series is transformed w.r.t Box-Cox lambda due to the prevailing heteroscedasticity and then it is twiced differenced to eliminate the trend in the data. The first ACF/PACF plot (w/o transformation) suggest that an ARIMA model should be fitted to the model; whereas the second ACF/PACF (with transformation) plot suggests that an AR model should be fitted. However both of them depend on the same data. In both of the case, the auto.arima function selects the best model as ARIMA(1,2,1) which can be expected according to the first plot but not according to the second plot due to the one spike in PACF.

dmnd=c(8.6,9.8,11.2,12.4,13.5,15.7,18.6,21.1,22.3,23.6,24.6,26.3,28.3,29.6,33.3,36.4,40.5,44.9,48.4,52.6,56.8,60.5,67.2,73.4,77.8,85.6,94.8,105.5,


114.0,118.5,128.3,126.9,132.6,141.2,150.0,160.8,174.6,190.0,198.1,194.1,210.4,230.3,242.4,246.4,257.2)

x=ts(dmnd,frequency=1)

sdx=diff(x,differences = 2)
x1<-acf(sdx,length(sdx),ylab="Sample ACF",main ="")
x2<-pacf(sdx,length(sdx),ylab="Sample PACF",main ="")

library(FitAR)

#transformation
fit=arima(x,order=c(0,2,0))
BoxCox(fit, interval = c(-1, 1), type = "BoxCox")

library(forecast)
tx=BoxCox(x, -0.049)

sdx=diff(tx,differences = 2)
x1<-acf(sdx,length(sdx),ylab="Sample ACF",main ="")
x2<-pacf(sdx,length(sdx),ylab="Sample PACF",main ="")

fit=auto.arima(x,d = 2,D = 0,start.p=0, start.q=0, max.p=5, max.q=5,stationary=FALSE,seasonal=FALSE,stepwise=TRUE,trace=TRUE,approximation=FALSE,allowdrift=TRUE,ic="aicc",lambda=-0.049)

par(mfrow=c(1,2))
x1<-acf(fit$residuals,length(fit$residuals),ylab="Sample ACF",main ="")
x2<-pacf(fit$residuals,length(fit$residuals),ylab="Sample PACF",main ="")

Box.test(fit$residuals, lag = length(fit$residuals)/5, type = c("Ljung-Box"), fitdf = length(fit$coef)) shapiro.test(fit$residuals)

library(TSA)
x.standard=rstandard.Arima(fit)
qqnorm(x.standard,main ="")
qqline(x.standard)


Results of ARIMA(3,1,0) Model

Shapiro-Wilk normality test

data:  fit$residuals W = 0.8557, p-value = 5.153e-05 Box-Ljung test data: fit$residuals
X-squared = 14.2044, df = 6, p-value = 0.02743


Diagnostics of Residuals ARIMA(1,1,1) transformed

auto.arima result for the series without the observations "32, 40, 41"

• You might want to share the data as optimal Box-Cox transforms should be based upon the residuals from a useful model not necessarily the original series. . – IrishStat Aug 30 '15 at 22:01
• @IrishStat There exists dispersion in the original data so the transformformation should be carried out. I posted the data and the codes that I use. – Dirk Aug 30 '15 at 22:40
• Dispersion in the original data may be caused by unusual values , changes in model parameters over time etc. Either way the requirements for the F Test and the T test are that the errors from a model have constant variance not that the errors around a simple mean have constant variance. When you analyze the original series you are implicitely assuming a simple mean is the best model. I will look at your data. – IrishStat Aug 30 '15 at 23:39
• I should also comment that variance change can sometimes be at a particular points in time culminating in Weighted Least Squares.. Box - Cox transforms remedies linkage between the expected value of Y and the dispersion in the error process. The treat different non-constant error variance symptoms. – IrishStat Aug 31 '15 at 2:01
• @IrishStat The forecasts does not seem better without the transformations. Well, I think that the sample ACF and PACF does not always reflect the theoretical patterns. If the model is chosen based on AICc and the diagnostic tests are satisfied, the box-cox transformed model is adequate. – Dirk Aug 31 '15 at 13:15

## 1 Answer

I took your data (45 observations) into AUTOBOX ( a piece of software that I have helped develop) and it automatically tested for a deterministic change in error and optionally for a Box-Cox transformation. The preferred model is here logs being found to be optimal . When and where to apply Box-Cox is here When (and why) should you take the log of a distribution (of numbers)? . The acf of the residuals from this hybrid model and the plot of actual/fit/forecast is here . The forecasts are shown here . The conclusion that only first differences are needed along with an AR(3) polynomial (without lag2 ) and three pulse indicators at (32,40 and 41)

REVISED TO EXPLAIN THE FLAW OF TRANSFORMING BASED UPON THE ORIGINAL SERIES:

One last time ..... Perhaps this wlll help you understand the (sometimes) fatal flaw of determining the transform based upon the original series. http://www.autobox.com/cms/index.php/afs-university/intro-to-forecasting/doc_download/53-capabilities-presentation starting at slide 58. It shows the classic AIRLINE series incorrectly transformed because the original series was studied (thus no model in place) . The original series suitably differenced and fitted with a simple ARIMA model yielded a few outliers that untreated inadvertently led to an uneeded log transformation. You are not alone in this misunderstanding as is detailed by the approach taken by the majority of software vendors.

A detailed discussion of other vendors approach and too many textbooks to mention is here http://www.autobox.com/pdfs/vegas_ibf_09a.pdf

• I appreciate your comments. Thx. Sure, the outliers are not considered in AICc or in the model list. I couldn't get what AR(3) polynomial (without lag2 ) means. But I computed ARIMA(3,1,0) by using R. There is no way to validate the corresponding model for adequacy both visually and analytically (also an overfitted model). – Dirk Aug 31 '15 at 14:16
• In your post, I also recognized that one value is at the limit in ACF plot. But the box-cox transformed series is validated for adequacy. I haven't found a TSA model that can be adequately fitted to the series without transformation (once or twice differenced). In general, if the original series is not homoscedastic and normally distributed, I doubt that the residuals will be homoscedastic and normally distributed. – Dirk Aug 31 '15 at 14:16
• You can doubt all you want but I can guarantee you that the correct thing to do is to ensure that the errors are normally distributed ..but what do I know as I have only been involved(solely) for the last 48 years. – IrishStat Aug 31 '15 at 18:47
• I respect that. I posted the ACF/PACF and Q-Q plot. Also, I posted the codes. If u try, u will get the same results. In this case, transformation is necessary. – Dirk Aug 31 '15 at 19:02