## Segment Univariate Time Series Data

Occasional Contributor
Posts: 17

# Segment Univariate Time Series Data

Hi,
I have sales data for 30 stores on a daily basis. The store stocks only one type of item and there is a seasonal pattern to sales. The business would like to understand if certain periods should be grouped together (day 1 - 60, 61 - 180, etc) so they can manage demand for products accordingly. They currently derive the day groups visually (around 5-6 groups for each store) and since they have only 30 stores, it is easily managable to visually inspect sales data.

However, they would like to understand if a data driven approach can be used to group days together.

Grateful for any suggestions on how to approach this problem.

 Store ID Day No Sales 1 1 125 1 2 140 1 3 166 … … … … … … … … … 1 363 300 1 364 321 1 365 340

Occasional Contributor
Posts: 17

## Univariate Time Series Segmentation

Hi,
I have sales data for 30 stores on a daily basis. The store stocks only one type of item and there is a seasonal pattern to sales. The business would like to understand if certain periods should be grouped together (day 1 - 60, 61 - 180, etc) so they can manage demand for products accordingly. They currently derive the day groups visually (around 5-6 groups for each store) and since they have only 30 stores, it is easily managable to visually inspect sales data.

However, they would like to understand if a data driven approach can be used to group days together.

Grateful for any suggestions on how to approach this problem.

 Store ID Day No Sales 1 1 125 1 2 140 1 3 166 … … … … … … … … … 1 363 300 1 364 321 1 365 340

Posts: 4,930

## Re: Univariate Time Series Segmentation

You could try to find optimal date ranges with HPSPLIT. For 5 periods of at least 10 days, you would use:

``````proc hpsplit data=myStoreData
leafsize=10 maxbranch=5;
input date / level=int;
target sales / level=int;
output nodestats=myStoreDataSplit;
run;``````

The procedure will try to minimize the variance of sales within each period.

PG
Occasional Contributor
Posts: 17

## Re: Univariate Time Series Segmentation

If my time series data had features, how would I go about doing this. Say for each day, I had other attributes like sale indicator, customer footfall in the store, web visits, etc, how would I then approach this problem. I was considering clustering but this could end up grouping days wierdly (e.g. days 1, 40, 80 and 90 are in Cluster 1, etc).

Is there an approach to structural breaks in time series with multiple attributes? Would love to try an open source implementation for this.

Grateful for suggestions.

Discussion stats
• 3 replies
• 278 views
• 0 likes
• 2 in conversation