BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mmyrto
Quartz | Level 8

I have a hierarchical time series (using SAS Forecast studio for desktop). Total-->Region and each region is made out of states. For one state i have history less than 24 months ( i have 13 but the first couple of months not very reliable info) what are some suggestions as to how to handle this?

1 ACCEPTED SOLUTION

Accepted Solutions
alexchien
Pyrite | Level 9

proc similarity also supports time warping so that series with different length can be compared. you probably dont need the use the time warping functionality, just compute the similary using the common months across all states. Please check the doc to see how to disable time warping in proc similarity.

 

once similar state(s) are found, you first take the simple average of similar states by each year/month. Then you compare the difference between the state averages with the state with short history using the months when data is available in all states. For example, the state average/state with short histoty is 1.5. You then copy the state averages for the missing months and adjust the averages down by a factor of 1.5. you can make the adjustment factor by month as well.

View solution in original post

7 REPLIES 7
alexchien
Pyrite | Level 9

I can think of 2 approaches:

 

1. "Making the history". Basically copy the data of the current year to last year so that the hierarchical aggregation won't be affected by the missing historical data. You can make some trend adjustment while copying the data by looking at the trend from other states. You can also try to run a regression model on all states or just the states within a region to predict/impute the missing history,

 

2. "Leave it out". If the data for a state is short and not reliable, leave it out so that you can get the best possible forecasts for other states. You can then some similarity analysis between the state in question and other states to find a similar states using the existing 13+ month data. You can use PROC SIMILARITY (SAS/ETS) to measure the similarities between time series. Once you have identified the similar states, you can average out the forecasts by each period and then adjust the level based on the 13+ month of data. Basically you are borrowing the shape of the forecasts from similar states and adjust the forecast level based on the state's own data.

 

Hope this helps

 

mmyrto
Quartz | Level 8

Can you perform similarity analysis within SAS forecast Studio? Im guessing no bcs you said SAS /ETS. How should the data be entered in order to do the similarity test? every state should be in a column?

alexchien
Pyrite | Level 9

You are right for both questions. Since forecast studio license includes SAS/ETS, you should be able to access PROC SIMILARITY via a regular SAS session. Also the each state should be a column in the input data for PROC SIMILARITY.

 

here is an example from the proc documentation:

 

This simple example illustrates how to compare two time sequences using similarity analysis. The following statements create an example data set that contains two time sequences of differing lengths.

   data test;
   input i y x;
   datalines;
   1   2  3
   2   4  5
   3   6  3
   4   7  3
   5   3  3
   6   8  6
   7   9  3
   8   3  8
   9  10  .
   10 11  .
   ;
   run;

The following statements perform similarity analysis on the example data set:

   ods graphics on;
   proc similarity data=test out=_null_
      print=all plot=all;
      input x;
      target y / measure=absdev;
   run;
   
mmyrto
Quartz | Level 8

ok im starting to do this ... what if i want to run the similarity based on two variables? For example for each state i have Activations and Deactivations data, could i do similarity based on both or separate for each var? Also after i run the similarity how do i apply the trend to create the history for the state with limited data, in order to run the time series?

alexchien
Pyrite | Level 9

PROC SIMILARITY only supports univariate similaity at this point. Multivariate similarity is currently in the developemnt phase. Thus you will have to do similarity by each variable.

mmyrto
Quartz | Level 8

So i transposed my data and i have the following columns:

date, State1,....state28

For all states except state 28 i have 36 obs for state 28 i have 15 obs, but i have the last 15 observations so i am missing the history.

Do i run the proc similarity as is on this datatset?

 

alexchien
Pyrite | Level 9

proc similarity also supports time warping so that series with different length can be compared. you probably dont need the use the time warping functionality, just compute the similary using the common months across all states. Please check the doc to see how to disable time warping in proc similarity.

 

once similar state(s) are found, you first take the simple average of similar states by each year/month. Then you compare the difference between the state averages with the state with short history using the months when data is available in all states. For example, the state average/state with short histoty is 1.5. You then copy the state averages for the missing months and adjust the averages down by a factor of 1.5. you can make the adjustment factor by month as well.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 2089 views
  • 2 likes
  • 2 in conversation