Page 173 - Data Science Algorithms in a Week
P. 173
Time Series Analysis
Analyzing seasonality
Now we analyze seasonality - how data changes across months. From our observations, we
know that, for some months, sales tend to be higher, whereas, for other months, sales tend
to be lower. We evaluate the differences between the linear trend and the actual sales. Based
on the pattern observed in these differences, we produce a model of seasonality to predict
sales more accurately for each month:
Sales for
January
Year 2010 2011 2012 2013 2014 2015 2016 2017 Average
Actual 10.5 11.9 13.2 14.6 15.1 16.5 18.9 20
sales
Sales on 13.012 14.291 15.57 16.849 18.128 19.407 20.686 21.965
the trend
line
Difference -2.512 -2.391 -2.37 -2.249 -3.028 -2.907 -1.786 -1.965 -2.401
Sales for
February
Year 2010 2011 2012 2013 2014 2015 2016 2017 Average
Actual 11.9 12.6 14.4 15.4 17.4 17.9 19.5 20.8
sales
Sales on 13.1185833333 14.3975833333 15.6765833333 16.9555833333 18.2345833333 19.5135833333 20.7925833333 22.0715833333
the trend
line
Difference -1.2185833333 -1.7975833333 -1.2765833333 -1.5555833333 -0.8345833333 -1.6135833333 -1.2925833333 -1.2715833333 -1.3575833333
Sales for
March
Year 2010 2011 2012 2013 2014 2015 2016 2017 Average
Actual 13.4 13.5 16.1 16.2 17.2 19.6 19.8 22.1
sales
Sales on 13.2251666667 14.5041666667 15.7831666667 17.0621666667 18.3411666667 19.6201666667 20.8991666667 22.1781666667
the trend
line
Difference 0.1748333333 -1.0041666667 0.3168333333 -0.8621666667 -1.1411666667 -0.0201666667 -1.0991666667 -0.0781666667 -0.4641666667
Sales for
April
Year 2010 2011 2012 2013 2014 2015 2016 2017 Average
Actual 12.7 13.6 14.9 17.8 17.8 20.2 19.7 20.9
sales
Sales on 13.33175 14.61075 15.88975 17.16875 18.44775 19.72675 21.00575 22.28475
the trend
line
Difference -0.63175 -1.01075 -0.98975 0.63125 -0.64775 0.47325 -1.30575 -1.38475 -0.60825
Sales for
May
Year 2010 2011 2012 2013 2014 2015 2016 2017 Average
Actual 13.9 14.6 15.7 17.8 18.6 19.1 20.8 21.5
sales
[ 161 ]