Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-281

ARCH(q) Variance

Problem

Compute the conditional variance of an ARCH(q) model: sigma2 = omega + sum over i of alpha_i * e2_lag_i, pairing alphas and lagged squared shocks in order.

Extra coefficients or shocks beyond the shorter list are ignored.

Hint

With no lag terms the conditional variance collapses to the long-run constant omega.

Test cases

case 1
in: [0.05,[0.3,0.2],[1,0.5]]
expected: 0.44999999999999996
case 2
in: [0.1,[],[]]
expected: 0.1
case 3
in: [0.02,[0.5],[0.04]]
expected: 0.04
case 4
in: [0,[0.1,0.1,0.1],[1,2,3]]
expected: 0.6000000000000001
Starter codePython
def arch_q_variance(omega, alphas, lagged_sq):
    # Your code here
    pass

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