All problems
Error Variance from Psi Weights
Problem
Compute the variance of a forecast error from the psi weights of a linear time series model. Given psi coefficients and an innovation variance sigma2, the h-step error variance is sigma2 times the sum of squared psi weights.
An empty psi list gives a variance of 0.0.
Hint
The first psi weight is always 1, contributing the current innovation variance.
Test cases
case 1
in: [[1,0.5],2]
expected: 2.5
case 2
in: [[],1]
expected: 0
case 3
in: [[1],0.5]
expected: 0.5
case 4
in: [[1,-0.5,0.25],4]
expected: 5.25
case 5
in: [[0,0],3]
expected: 0
Starter codePython
def error_variance_from_psi(psi, sigma2):
# Your code here
pass5 test cases · run your code against them in the editor