code: def test_ewma_forecast(self):
      t = self.t
      vol = EWMAVariance()
      params = np.array([])
      resids = self.resid
      backcast = vol.backcast(resids)
      var_bounds = vol.variance_bounds(resids)
  
      forecast = vol.forecast(
          params, resids, backcast, var_bounds, horizon=10, start=0
      )
  
      expected = np.zeros(t + 1)
      expected[0] = backcast
      lam = 0.94
      for i in range(1, t + 1):
          expected[i] = (
              lam * expected[i - 1] + (1 - lam) * resids[i - 1] ** 2
          )
      for i in range(10):
          assert_allclose(forecast.forecasts[:, i], expected[1:])
  
      alt_forecast = vol.forecast(
          params, resids, backcast, var_bounds, horizon=10, start=500
      )
      _compare_truncated_forecasts(forecast, alt_forecast, 500)
  
      vol_estim = EWMAVariance(lam=None)
      param_estim = np.array([0.94])
      forecast_estim = vol_estim.forecast(
          param_estim, resids, backcast, var_bounds, horizon=10, start=0
      )
      for i in range(10):
          assert_allclose(
              forecast.forecasts[:, i], forecast_estim.forecasts[:, i]
          )
  
imports: import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from arch.univariate import arch_model
  from arch.univariate.distribution import Normal, StudentsT
  from arch.univariate.mean import ConstantMean
  from arch.univariate.volatility import APARCH, EGARCH, FIGARCH, GARCH, HARCH, BootstrapRng, ConstantVariance, EWMAVariance, FixedVariance, MIDASHyperbolic, RiskMetrics2006
label_desc: Use image node_id 27 for calling the TestVarianceForecasts obj's underlying member method code with example usage: obj.test_ewma_forecast() without return types