title: Decompose Time series into Trend, Seasonality and Random for multiple groups in R for monthly data
body: <p>THis is the first time i am working on time series, hence kindly pardon me for anything wrong in my approach.</p>
  
  <p>I have monthly sales data for multiple Groups. THe data is for 3 years, and i would like to implement time series analysis for the same. I am not sure if 3 years data is actually good enough, but however i would like to understand it better.</p>
  
  <p><strong>I currently understand that the time series is decomposed into three parts- Trend, Seasonality and Random.</strong></p>
  
  <p><strong>I want to split my Sales data for each Group, into the Trend, Seasonality and Random part. Since trend and seasonality are gone, hence i want to use only random to understand the Sales metrics better.</strong></p>
  
  <p>Since data is monthly, hence i need to use multiplicative. 
  Should i use STL or decompose?</p>
  
  <p>I have the basic Decompose code, however not sure how to incorporate the same for multiple groups, to identify the trend, seasonality and random for each group.</p>
  
  <p>I am not referring to ARIMA model. I am basically referring to the standard time series approach.</p>
  
  <p>Below is how my data looks like.</p>
  
  <pre><code>Group   Date    Month   Sales
  Group1  Jan-15  1   75030
  Group1  Feb-15  2   16073
  Group1  Mar-15  3   17161
  Group1  Apr-15  4   94946
  Group1  May-15  5   62999
  Group1  Jun-15  6   4698
  Group1  Jul-15  7   76743
  Group1  Aug-15  8   28800
  Group1  Sep-15  9   12225
  Group1  Oct-15  10  71793
  Group1  Nov-15  11  26686
  Group1  Dec-15  12  6252
  Group1  Jan-16  13  82698
  Group1  Feb-16  14  71201
  Group1  Mar-16  15  65798
  Group1  Apr-16  16  4407
  Group1  May-16  17  7491
  Group1  Jun-16  18  24366
  Group1  Jul-16  19  99616
  Group1  Aug-16  20  74443
  Group1  Sep-16  21  54122
  Group1  Oct-16  22  20762
  Group1  Nov-16  23  91376
  Group1  Dec-16  24  18693
  Group1  Jan-17  25  30395
  Group1  Feb-17  26  82049
  Group1  Mar-17  27  79701
  Group1  Apr-17  28  38862
  Group1  May-17  29  84802
  Group1  Jun-17  30  81715
  Group1  Jul-17  31  60786
  Group1  Aug-17  32  88731
  Group1  Sep-17  33  28502
  Group1  Oct-17  34  79245
  Group1  Nov-17  35  15553
  Group1  Dec-17  36  3237
  Group2  Jan-15  1   8990
  Group2  Feb-15  2   47516
  Group2  Mar-15  3   15076
  Group2  Apr-15  4   60888
  Group2  May-15  5   47111
  Group2  Jun-15  6   7770
  Group2  Jul-15  7   25080
  Group2  Aug-15  8   46586
  Group2  Sep-15  9   12595
  Group2  Oct-15  10  71883
  Group2  Nov-15  11  21634
  Group2  Dec-15  12  78799
  Group2  Jan-16  13  57596
  Group2  Feb-16  14  35685
  Group2  Mar-16  15  68518
  Group2  Apr-16  16  35661
  Group2  May-16  17  65294
  Group2  Jun-16  18  62602
  Group2  Jul-16  19  13506
  Group2  Aug-16  20  49215
  Group2  Sep-16  21  32008
  Group2  Oct-16  22  27924
  Group2  Nov-16  23  56146
  Group2  Dec-16  24  23975
  Group2  Jan-17  25  18686
  Group2  Feb-17  26  77076
  Group2  Mar-17  27  63992
  Group2  Apr-17  28  38087
  Group2  May-17  29  19846
  Group2  Jun-17  30  46823
  Group2  Jul-17  31  11035
  Group2  Aug-17  32  73686
  Group2  Sep-17  33  35523
  Group2  Oct-17  34  97417
  Group2  Nov-17  35  27954
  Group2  Dec-17  36  79004
  </code></pre>
  
  <p>Below is my code.</p>
  
  <pre><code>x &lt;- ts(df, start = c(2015, 1), end = c(2017, 12), frequency = 12)
  m &lt;- decompose(x)
  </code></pre>
  
  <p>Please correct me if there is something wrong in my approach, since I am new to time series modelling.</p>
  
  <p>Thanks,</p>
  
  <p>Jay</p>