# Time Series Decomposition - autocorrelation of error term

I would like to do time series decomposition, but the error term has a serial autocorrelation at the end and I am freaking out because I have really no idea what to do with that.

How I did it? I tried to use ucm command in Stata but I faced a lot of problems, always having some errors. Finally only the command  ucm TOTAL, seasonal(12) iterate(11) from(e(b))  worked but it gave me only the trend component. later when I was trying to do the further components I had millions of problems in my Stata, so I simply calculated the seasonal component in Excel and then simply the Trend component from Stata * Seasonal Component from Excel = Predicted model  and then Sample - Model = Error.

And Breusch-Godfrey test in Stata shows autocorrelation :

 Chi2 Prob>chi2 26,261 0,0000 

Can someone please correct my messy thinking and help me to do the decomposition of time series or what should i do with the fact that error is autocorrelated?

my output:

• An autocorrelated "error" (you could call it "remainder" if you do only seasonal adjustment and nothing else) might make sense. There could be something going on in your data besides pure seasonality. On the other hand, if you assume that the only regular component of you data is seasonal and the remainder is purely random (no link between the seasonally adjusted values over time), then by definition you would wish to have no patterns in the remainder, and then your worries make sense. – Richard Hardy Nov 26 '14 at 16:00
• what this tells you is that decomposition did not adequately capture all the pattern in your dataset. This is very common. Besides trend and seasonality you have Autoregressive and Moving average structure still remaining in your data. You could model the error term using an AR/MA/ARMA. UCM is able to do this automatically for the irregular component aka error term. – forecaster Nov 26 '14 at 16:07
• @forecaster correctly points out the method you are using is quite dated and never promises the deliverance of an error term free of both stochastic and deterministic structure. Just incorporate correct/mimimally sufficient ARIMA structure AND any needed deterministic structure like trend terms,seasonal dummies, changes in seasonal dummies and also validate non-transient assumptions regarding both parameters and error variance. – IrishStat Nov 26 '14 at 16:14