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

## Time series with a state with less than 24 months of history

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
Pyrite | Level 9

## Re: Time series with a state with less than 24 months of history

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.

7 REPLIES 7
Pyrite | Level 9

## Re: Time series with a state with less than 24 months of history

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

Quartz | Level 8

## Re: Time series with a state with less than 24 months of history

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?

Pyrite | Level 9

## Re: Time series with a state with less than 24 months of history

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;
```
Quartz | Level 8

## Re: Time series with a state with less than 24 months of history

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?

Pyrite | Level 9

## Re: Time series with a state with less than 24 months of history

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.

Quartz | Level 8

## Re: Time series with a state with less than 24 months of history

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?

Pyrite | Level 9

## Re: Time series with a state with less than 24 months of history

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.

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