Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-061

Impulse Response Step

Problem

For an AR(1) model x[t] = phi * x[t-1] + e[t], return the impulse response at horizon h, which is phi raised to the power h.

Return 0.0 when h is negative.

Hint

A shock's effect decays geometrically at rate phi.

Test cases

case 1
in: [0.5,3]
expected: 0.125
case 2
in: [0.9,0]
expected: 1
case 3
in: [-0.5,2]
expected: 0.25
case 4
in: [0,5]
expected: 0
Starter codePython
def impulse_response_ar1(phi, h):
    # Your code here
    pass

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