def forecast_cov(ma_coefs, sig_u, steps):
 k = len(sig_u)
 forc_covs = np.zeros((steps, k, k))
 prior = np.zeros((k, k))
 for h in range(steps):
  phi = ma_coefs[h]
  var = chain_dot(phi, sig_u, phi.T)
  forc_covs[h] = prior = (prior + var)
 return forc_covs

def forecast_cov ( ma_coefs , sig_u , steps ) : k = len ( sig_u ) forc_covs = np . zeros ( ( steps , k , k ) ) prior = np . zeros ( ( k , k ) ) for h in range ( steps ) : phi = ma_coefs [ h ] var = chain_dot ( phi , sig_u , phi . T ) forc_covs [ h ] = prior = ( prior + var ) return forc_covs
compute theoretical forecast error variance matrices parameters returns forc_covs : ndarray .