The Repeating Part
values is a series that repeats a pattern every period steps on top of a slow trend. Split it with an additive seasonal decomposition and return one full cycle of the seasonal part: its first period values.
Example 1
values [1,-1,0,0,2,0,1,1,3,1,2,2,4,2,3,3,5,3,4,4,6,4,5,5]
period 4
returns [1.375,-0.875,-0.125,-0.375]
The series is a steady climb plus the pattern 1, -1, 0, 0 again and again.
Example 2
values [10,20,10,20,10,20,10,20]
period 2
returns [-5.0,5.0]
The series alternates 5 below and 5 above its level of 15.
Constraints
2 <= period <= 12len(values)is at least 2 full periods, up to 96
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- Which Findings SurviveHard
- How Much Is ExplainedBeginner
- How Sure Is the SlopeBeginner
- Line Through ZeroBeginner
- Line Through the DataBeginner
- Reading Off the LineBeginner
- Room for the InterceptBeginner
- Slope From a TableBeginner