seasonality in serie

Copper Contributor

Hi,

 

I am having the array below for my time serie. When I run 

project series_periods_detect(s, 0, 168, 2) to find seasonalities it detects a 24h seasonality as expected ( these are hourly data).
 
Now when I try to extract the seasonal component using the command below, I only get 0 for each point. Since it detects the period, I was expecting to get the component. I am not sure what is happening. Here is the query I am using to extract seasonality: 
| extend s_seasonal_daily = series_seasonal(s,24)

 

Here is my serie. Please see file attached for output.

print s=dynamic(
[-2,-11,7.5,2.5,-4,-2,5,-0.5,1.5,0.5,2.5,-2,-0.5,0.5,0,0,-0.5,0.5,-2,-10.5,-4,-6,-14,-7.5,-15,-1,-7,-5.5,-17,0.5,-4.5,-1.5,2.5,1,0,0,-2,0,-1.5,1,0,0,-11.5,-16.5,-29,-19,-25,-11,-6,-15,-3.5,-8.5,-13,5,-6.5,1,2,2.5,-1,0.5,1.5,0,1,1,-1,-0.5,-3.5,-5.5,-13.5,-7.5,0.5,-17.5,-5,-12,-4,-1.5,-6.5,4.5,1.5,-1.5,-5,-2,-1.5,0.5,1.5,0,-0.5,0,-1.5,3,-8,-15,-5,-11.5,-13,-9,-6,2,0,-15,2,-1.5,0,0,-1,0,0,0,0,1.5,-1,1.5,-1,1,-11.5,-2,-15,-17.5,-10,-18.5,-6.5,-12,-20,-3.5,-11,-3.5,1,0.5,2.5,2,3,0,-0.5,-1,-0.5,-0.5,-0.5,-0.5,-11,-20.5,-7,-13.5,-14,-15.5,-3.5,-16.5,-12,3.5,2.5,17,2.5,0,3,0,0,-1,0,0.5,0,0.5,0.5,-2,0,-14.5,-11.5,-22,-23.5,-10.5,-13,-3,-2.5,-2.5,4,6,2,0.5,0.5,0.5,0.5,2,0.5,1.5,0,0,1.5,-1.5,-5,-3.5,-13,-20,-13,-7.5,-22,-16,-11,-13.5,-10,-0.5,-0.5,1.5,0.5,0,-1,0,0,0,0.5,0,-1,-2,-7.5,-9.5,-20,-20,-16,-16,-19,-11,-7.5,-14.5,6,-5,-0.5,1,-2,0.5,2,-0.5,-0.5,1,0,0,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,-0.5,0,0,0,7.5,9.5,20,19,25,11,6,11,3.5,8.5,-6,-17,0.5,-4,-2,-1.5,0,1.5,-0.5,0,0,0,-1,4.5,18.5,10.5,22.5,20.5,29.5,27.5,19,12,19,11.5,17.5,1.5,-0.5,0.5,1,0,0.5,-0.5,0.5,0,-0.5,-1,-0.5,4,17,9,18,8.5,30,15,15,25,14,23,15,0.5,0,0,1,-2,-2,0,0,0.5,0,-0.5,-1,1,9.5,25,30,24.5,20,22.5,35.5,27,27,16.5,8,2.5,1,-0.5,-2.5,-1,1,0,-1.5,1,-0.5,0.5,-1.5,0.5,9,3.5,19,10.5,7,5.5,0.5,15.5,-2,-3.5,-2.5,0,1.5,0,2,3,0,3,0,-0.5,1,-0.5,-0.5,-2,23,2.5,19.5,10,21.5,9.5])
1 Reply

@mrom34 series_seasonal computes the seasonal component across the entire series - the seasonal part is the median of each bin across all periods. Since in the given series it starts with periods below zero and then periods above zero it happens for this specific case that the seasonal component for a period of 24 points is actually zero, you can verify it with the following query:

 

print s=dynamic(
[-2,-11,7.5,2.5,-4,-2,5,-0.5,1.5,0.5,2.5,-2,-0.5,0.5,0,0,-0.5,0.5,-2,-10.5,-4,-6,-14,-7.5,-15,-1,-7,-5.5,-17,0.5,-4.5,-1.5,2.5,1,0,0,-2,0,-1.5,1,0,0,-11.5,-16.5,-29,-19,-25,-11,-6,-15,-3.5,-8.5,-13,5,-6.5,1,2,2.5,-1,0.5,1.5,0,1,1,-1,-0.5,-3.5,-5.5,-13.5,-7.5,0.5,-17.5,-5,-12,-4,-1.5,-6.5,4.5,1.5,-1.5,-5,-2,-1.5,0.5,1.5,0,-0.5,0,-1.5,3,-8,-15,-5,-11.5,-13,-9,-6,2,0,-15,2,-1.5,0,0,-1,0,0,0,0,1.5,-1,1.5,-1,1,-11.5,-2,-15,-17.5,-10,-18.5,-6.5,-12,-20,-3.5,-11,-3.5,1,0.5,2.5,2,3,0,-0.5,-1,-0.5,-0.5,-0.5,-0.5,-11,-20.5,-7,-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1,0.5,4,-3,10.5,2,3,1.5,8,7.5,6.5,12,4,3.5,4,8.5,-1,-1.5,0.5,0,-1,0,0.5,-1,0.5,-0.5,1.5,1.5,0,-0.5,6,19.5,16,25.5,22.5,-1.5,19,4.5,2.5,0,-2.5,-5,-2,0,2,-1,-1,-0.5,0,3.5,0.5,4,0,3.5,11.5,22,9.5,27.5,23,24,2.5,2.5,9,-2,-4,0.5,-2.5,-0.5,-1.5,-1,-0.5,-0.5,1,1,-3.5,-0.5,2,3.5,18,26,23,29.5,17,21,10,5.5,10,-0.5,0.5,-3.5,-0.5,0,0,0,0,0,-0.5,0,0,0,7.5,9.5,20,19,25,11,6,11,3.5,8.5,-6,-17,0.5,-4,-2,-1.5,0,1.5,-0.5,0,0,0,-1,4.5,18.5,10.5,22.5,20.5,29.5,27.5,19,12,19,11.5,17.5,1.5,-0.5,0.5,1,0,0.5,-0.5,0.5,0,-0.5,-1,-0.5,4,17,9,18,8.5,30,15,15,25,14,23,15,0.5,0,0,1,-2,-2,0,0,0.5,0,-0.5,-1,1,9.5,25,30,24.5,20,22.5,35.5,27,27,16.5,8,2.5,1,-0.5,-2.5,-1,1,0,-1.5,1,-0.5,0.5,-1.5,0.5,9,3.5,19,10.5,7,5.5,0.5,15.5,-2,-3.5,-2.5,0,1.5,0,2,3,0,3,0,-0.5,1,-0.5,-0.5,-2,23,2.5,19.5,10,21.5,9.5])
| mv-expand with_itemindex=idx s to typeof(double)
| project idx, s
| extend bin_idx = idx % 24
| order by s asc 
| summarize s=make_list(s) by bin_idx
| extend seasonal_componenet = (todouble(s[13]) + todouble(s[14]))/2