Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Time series techniiques

    Hi all,

    I try it again
    I have a dataset having as inputs: the id of products, quarters, Year corresponding to quarter, sales, standard units (quantity of units sold) and price. All data are quarterly and in quarterly format:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(idproduct quarter) double(salesmnf stdunits) float(price Year trimestre log_sales)
     309 1  549428.8959562927   208530 2.6778486 2015 220 13.216635
     309 2 1657635.6735686143   621990   2.62871 2015 221 14.320903
     309 3 2361742.0307672094   879120  2.787183 2015 222  14.67491
     309 4  2708969.867707035   982620  2.783677 2015 223  14.81208
     967 1 184693056.44742548  2123448  69.92604 2006 184 19.034206
     967 2  186583645.8088604  2131386   72.9989 2006 185  19.04439
     967 3 195114029.24053717  2126052  76.26028 2006 186 19.089094
     967 4 211430381.58983797  2244936  78.51543 2006 187 19.169407
     968 1  94245656.30939752  1951221  43.02343 2010 200 18.361416
     968 2 106193726.41838197  2246121  40.94118 2009 197 18.480776
     968 3 126991064.20802969  2581852  43.04422 2009 198 18.659628
     968 4 131882758.77489536  2516289  43.29467 2009 199 18.697424
    4834 1  2386084.582423094  2936683  38.43847 2008 192 14.685164
    4834 2  2988950.166766347  3438293  31.67041 2007 189 14.910433
    4834 3  21072007.09334628 21285772  41.51537 2007 190 16.863457
    4834 4  4232758.643618916  4991422  47.45229 2007 191 15.258365
    6068 1 2856639582.4348493 31039572  54.41778 2004 176  21.77291
    6068 2  2868131337.495672 30779047  56.97757 2004 177 21.776926
    6068 3 2964321233.5777473 30719826  57.55517 2004 178 21.809914
    6068 4 3102891325.7371497 31502475  60.23185 2004 179   21.8556
    6069 1 1274750484.2723105 24761448  44.77084 2008 192 20.966017
    6069 2 1321443568.6101897 25389605  45.13775 2008 193  21.00199
    6069 3  1450067330.289578 26692361  59.08562 2008 194 21.094875
    6069 4  1622238762.625174 29031081  60.22854 2008 195 21.207073
    6070 1  126134306.5626635  2524050  44.07946 2008 192 18.652859
    6070 2 126160278.29548052  2526460  44.34878 2008 193 18.653063
    6070 3 133952400.29167828  2600550  45.94165 2008 194 18.712996
    6070 4 145466515.49067545  2759600  47.45404 2008 195 18.795456
    6071 1  715550633.3935665 13916068  43.81797 2008 192 20.388563
    6071 2  735844351.1348764 14172592  44.28768 2008 193  20.41653
    6071 3  787807606.7341623 14610150  46.09623 2008 194 20.484764
    6071 4  841888838.8800159 15310000  46.74739 2008 195  20.55116
    6072 1  75009962.13975018   647480  111.3589 2007 188 18.133131
    6072 2  74588181.81412561   646650  113.1978 2007 189 18.127493
    6072 3   77185508.6298286   655104 116.64356 2007 190 18.161722
    6072 4  80405694.76067226   669178 116.24467 2006 187 18.202595
    6073 1  967880303.1021518 10379874  98.05796 2004 176  20.69062
    6073 2  940204820.2090411  9971840  99.46415 2004 177  20.66161
    6073 3  943518026.6403258  9721450 102.63863 2004 178 20.665127
    6073 4  937029685.4230168  9462950 104.92355 2004 179 20.658226
    6074 1  325298810.4768621 10541274  29.95105 2009 196 19.600254
    6074 2 318927130.92226684 10325853 29.956696 2006 185 19.580473
    6074 3 318537182.08938503 10198362 30.118374 2004 178  19.57925
    6074 4 314911730.62714845  9984549 30.122837 2004 179   19.5678
    6075 1 23100089.994157523   680650 33.122414 2006 184 16.955347
    6075 2 23657358.264116693   704568  32.76325 2006 185 16.979185
    6075 3 24755341.757148325   736362 32.484085 2006 186 17.024551
    6075 4 24159466.021932237   714762 33.550167 2006 187 17.000187
    6076 1  402642339.2982397 13442632  29.97017 2008 192  19.81356
    6076 2 393652682.40141517 13099424 30.053415 2004 177  19.79098
    6076 3 384781974.31103617 12630738   30.3134 2007 190 19.768187
    6076 4  364490710.2282536 11896252 30.266676 2007 191  19.71401
    6077 1  154219.5423851413     2308  67.64907 2014 216 11.946133
    6077 2 166348.28589167312     2362  70.35483 2014 217  12.02184
    6077 3 275477.74374367687     4124  67.60611 2013 214 12.526262
    6077 4 241831.51024506125     3428  70.83441 2013 215 12.395996
    6078 1   95367.0953683665     1412  51.04691 2013 212 11.465488
    6078 2 101803.97800399363     1437  70.28399 2014 217 11.530805
    6078 3 129823.20117755304     2415  53.81084 2013 214  11.77393
    6078 4 146620.37886745489     2009  70.72038 2013 215 11.895602
    6079 1 31157.172649819393      462   50.8711 2013 212   10.3468
    6079 2 27570.082972937766      382  70.42646 2014 217 10.224486
    6079 3  32411.17721101825      690   52.5656 2013 214  10.38626
    6079 4  34842.60850121315      485  57.08928 2013 215 10.458596
    6096 1 15157838.529621929   498530 30.144026 2004 176 16.534029
    6096 2 13333880.397857638   447838 30.777826 2004 177 16.405819
    6096 3 13627377.140391372   438890  29.87494 2004 178 16.427591
    6096 4 13228555.729047967   424874  29.82808 2004 179 16.397888
    6097 1  1221010440.549058 29355894  37.75741 2004 176 20.922945
    6097 2 1188729687.6971447 28398778  37.74227 2004 177  20.89615
    6097 3 1200959683.2091687 27367918  38.23028 2004 178  20.90639
    6097 4 1169804504.5442507 26495182  40.07455 2004 179   20.8801
    6098 1  60036517.42085347   956812  54.05536 2014 216 17.910463
    6098 2 102515708.66158077  1718060  55.79046 2014 217 18.445526
    6098 3 109560137.83771564  1730052  58.85126 2014 218 18.511984
    6098 4 117026418.36660808  1800952  60.40058 2014 219  18.57791
    6099 1  248686246.0095292  8543084 26.423185 2004 176 19.331703
    6099 2 206204004.55350846  7612860  28.05136 2004 177 19.144377
    6099 3 215206932.38692236  7519608  25.85606 2004 178  19.18711
    6099 4 218863168.20073053  7538558 26.363764 2004 179 19.203957
    6100 1 15249277.111530745   533173 26.307264 2004 176 16.540043
    6100 2  13884645.76745506   492447   26.1729 2004 177 16.446295
    6100 3 13234970.984895848   452862  26.57682 2004 178 16.398373
    6100 4 10654929.521898188   367615 27.746534 2004 179 16.181534
    6101 1  680775094.3047991 17396700 36.580826 2004 176 20.338743
    6101 2  666172707.5121135 17052418 35.934723 2004 177  20.31706
    6101 3  657835756.2495023 16098298  38.31532 2004 178 20.304466
    6101 4  660488478.0382179 16378155 37.930885 2004 179  20.30849
    6102 1 23410712.260877848   384104  52.38548 2014 216 16.968704
    6102 2 37716567.630523756   647481  53.78031 2014 217  17.44561
    6102 3  45046688.97587415   721982  58.26444 2014 218  17.62321
    6102 4  50876506.96934605   801653  59.75441 2014 219 17.744911
    6103 1 107599801.57738319  3732895  26.34071 2004 176 18.493929
    6103 2  91907197.12198395  3392682  26.02587 2004 177  18.33629
    6103 3   95196010.3114374  3341626   25.7236 2004 178 18.371449
    6103 4   96756092.4612426  3345447  25.89199 2004 179 18.387703
    6104 1  619851443.7146848 10731429 162.90004 2004 176  20.24499
    6104 2   630954605.489009 10601957 170.46887 2004 177 20.262745
    6104 3  673440665.8650074 10430433   178.424 2004 178  20.32791
    6104 4  712145296.8299035 10708652 187.66664 2004 179 20.383793
    end
    format %tq trimestre
    Is there a way to deseasonalize such data (so unbalanced panel structure data)?

    Thanks,


    Federico

    Last edited by Federico Nutarelli; 04 Dec 2019, 02:26.

  • #2
    I'm not sure if it's just your example, but I can't think of a way to seasonally adjust panel data where each panel id only has four observations. In general, you'll want at least three years of data (so in your case 12 quarters for each product). Also, seasonal adjustment doesn't do well with missing data. If you have more observations per id, I would look into smoothing your data through tssmooth ma. It's not the same as seasonal adjustment per se, but the results are fairly similar and it's much easier to do. Hope this helps.

    Comment


    • #3
      Oh I see. Thank you a lot!

      Comment

      Working...
      X