All problems
STL Remainder Value
Problem
Compute the STL remainder for one observation: observed - trend - seasonal.
The remainder captures what the trend and seasonal components fail to explain at that time point.
Hint
STL decomposes the series additively, so the remainder is simple subtraction.
Test cases
case 1
in: [10,7,2]
expected: 1
case 2
in: [5,5,0]
expected: 0
case 3
in: [3.5,2,1.2]
expected: 0.30000000000000004
case 4
in: [0,0,0]
expected: 0
Starter codePython
def stl_remainder_value(observed, trend, seasonal):
# Your code here
pass4 test cases · run your code against them in the editor