All problems
Long-Run Variance Multiplier
Problem
Compute the long-run variance multiplier of a stationary series from its autocorrelations. For a list of autocorrelations r1, ..., rm, the multiplier is 1 + 2 * (r1 + ... + rm), which scales the variance when summing a long block of observations.
An empty list of autocorrelations gives a multiplier of 1.0.
Hint
Each autocorrelation appears twice in the double sum, once for +k and once for -k.
Test cases
case 1
in: [[0.5]]
expected: 2
case 2
in: [[0.5,0.25]]
expected: 2.5
case 3
in: [[]]
expected: 1
case 4
in: [[-0.25,0]]
expected: 0.5
Starter codePython
def long_run_variance_multiplier(rhos):
# Your code here
pass4 test cases · run your code against them in the editor