Skip to content
DeepForgeby svx
All problems
HardTime Seriests-352

AR(1) Forecast Error Variance at Horizon

Problem

Compute the variance of the h-step-ahead forecast error for an AR(1) model with innovation variance sigma2 and coefficient phi. The standard result is sigma2 * (1 - phi^(2h)) / (1 - phi^2).

When the absolute value of phi is at least one the process is not stationary, and the variance grows linearly as sigma2 * h. A horizon of zero or less gives 0.0.

Hint

The variance is bounded as h grows only when the process is stationary.

Test cases

case 1
in: [1,0.5,2]
expected: 1.25
case 2
in: [1,0,5]
expected: 1
case 3
in: [2,1,3]
expected: 6
case 4
in: [2,-1,3]
expected: 6
case 5
in: [1,0.5,0]
expected: 0
Starter codePython
def ar1_error_variance(sigma2, phi, h):
    # Your code here
    pass

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