2
$\begingroup$

I don't have a lot of experience working with time series data. Now I have a 3 year, monthly data for several entities (you can think about them as different stores), that I would like to do some analysis, e.g. regression. I am not sure if there are trend and seasonality effects on these series. Using the package Forecast in R, and applying the function stl, I decomposed the series and plotted them. I have attached some of the resulting plots (for different stores):

trend 2

trend 3

trend 4

When I print the result of the fitted stl function, I get something like this:

 Call:
 stl(x = dlr1, s.window = "period")

 Components
            seasonal      trend   remainder
 Jan 2010 -0.05643233 -0.2151193 -0.02526416
 Feb 2010 -0.14799311 -0.2193160  0.13137861
 Mar 2010  0.10125889 -0.2235127  0.13747509
 Apr 2010 -0.29720645 -0.2266819 -0.47611165
 May 2010 -0.22746429 -0.2298511  0.28988090
 Jun 2010  0.12403035 -0.2320100  0.05470502
 Jul 2010 -0.10418880 -0.2341688  0.15684340
 Aug 2010  0.14560622 -0.2358294 -0.25225647
 Sep 2010  0.16699531 -0.2374901 -0.35570221
 Oct 2010 -0.21709617 -0.2402783  0.13772671
 Nov 2010  0.20363225 -0.2430665  0.19027750
 Dec 2010  0.30885826 -0.2444804 -0.11424289
 Jan 2011 -0.05643233 -0.2458944  0.16533482
 Feb 2011 -0.14799311 -0.2329029  0.09169095
 Mar 2011  0.10125889 -0.2199115 -0.33798701
 Apr 2011 -0.29720645 -0.2111018  0.58659147
 May 2011 -0.22746429 -0.2022921 -0.56724011
 Jun 2011  0.12403035 -0.2105492 -0.38534202
 Jul 2011 -0.10418880 -0.2188064  0.45324407
 Aug 2011  0.14560622 -0.2282670  0.15884344
 Sep 2011  0.16699531 -0.2377275  0.07834284
 Oct 2011 -0.21709617 -0.2372438  0.38658989
 Nov 2011  0.20363225 -0.2367601 -0.38545840
 Dec 2011  0.30885826 -0.2406277 -0.02293191
 Jan 2012 -0.05643233 -0.2444953 -0.14810135
 Feb 2012 -0.14799311 -0.2603740 -0.23092833
 Mar 2012  0.10125889 -0.2762527  0.19282561
 Apr 2012 -0.29720645 -0.2778357 -0.11752792
 May 2012 -0.22746429 -0.2794186  0.27095247
 Jun 2012  0.12403035 -0.2747109  0.32488093
 Jul 2012 -0.10418880 -0.2700031 -0.61519386
 Aug 2012  0.14560622 -0.2649596  0.08891071
 Sep 2012  0.16699531 -0.2599160  0.27346079
 Oct 2012 -0.21709617 -0.2550556 -0.52784826
 Nov 2012  0.20363225 -0.2501951  0.19201780
 Dec 2012  0.30885826 -0.2451385  0.13415736

Now based on these results, I am not sure how to decide whether there is a strong/weak trend and seasonality, and whether I should remove the trend and seasonality effects in order to build my regression model? In another words I would like to know how to interpret the plots and the resulting trend and seasonality numbers, e.g. what does it mean in Dec 2012 when it says "seasonal" = 0.30885826, etc.?

Thanks

$\endgroup$
3
$\begingroup$

The function stl returns smoothed versions of the original series, each representing the trend, seasonal and the irregular components. The values returned by stl are therefore the values that take each smoothed component at each time period.

The stl decomposition should not be used to decide on the presence of seasonality but to get the seasonal pattern once we have concluded that seasonality is present. See this post. You should use other tools, for example plotting the autocorrelation functions.

For the example that you posted (the data can be recovered as the sum of the components), the autocorrelations do not suggest any major pattern or structure.

original series and ACF PACF

Upon the graphical view of the data, it seems that in your regression model you should be more concerned with particular events that you may know from the history of the data (e.g. strike, heat wave,...) rather than with the presence of a seasonal pattern or trend.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.