Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-137

Local Linear Trend Step

Problem

Perform one step of a local linear trend model. With innovation = obs - (level + trend), update level_new = level + trend + alpha * innovation and trend_new = trend + beta * innovation.

Return [level_new, trend_new].

Hint

Both states are corrected from the same one-step innovation.

Test cases

case 1
in: [10,1,12,0.5,0.2]
expected: [11.5,1.2]
case 2
in: [5,0,5,0.3,0.1]
expected: [5,0]
case 3
in: [0,2,10,0.5,0.5]
expected: [6,6]
case 4
in: [10,1,8,1,1]
expected: [8,-2]
Starter codePython
def local_linear_trend_step(level, trend, obs, alpha, beta):
    # Your code here
    pass

4 test cases · run your code against them in the editor