code: def test_aparch_one_step(self):
      vol = APARCH()
      resids = self.resid
      backcast = vol.backcast(resids)
      var_bounds = vol.variance_bounds(resids)
      params = np.array([0.1, 0.1, -0.5, 0.8, 1.5])
      forecast = vol.forecast(
          params, resids, backcast, var_bounds, horizon=1, start=0
      )
      sigma2 = np.empty_like(resids)
      vol.compute_variance(params, resids, sigma2, backcast, var_bounds)
      assert_allclose(sigma2[1:], forecast.forecasts[:-1, 0])
      delta = params[-1]
      final = params[0]
      final += params[1] * (
          (np.abs(resids[-1]) - params[2] * resids[-1]) ** delta
      )
      final += params[3] * (sigma2[-1] ** (delta / 2.0))
      final **= 2.0 / delta
      assert_allclose(final, forecast.forecasts[-1, 0])
  
      delta = 2.0
      vol = APARCH(delta=delta)
      params = np.array([0.1, 0.1, -0.5, 0.8])
      sigma2 = np.empty_like(resids)
      vol.compute_variance(params, resids, sigma2, backcast, var_bounds)
      forecast = vol.forecast(
          params, resids, backcast, var_bounds, horizon=1, start=0
      )
      assert_allclose(sigma2[1:], forecast.forecasts[:-1, 0])
      final = params[0]
      final += params[1] * (
          (np.abs(resids[-1]) - params[2] * resids[-1]) ** delta
      )
      final += params[3] * (sigma2[-1] ** (delta / 2.0))
      final **= 2.0 / delta
      assert_allclose(final, forecast.forecasts[-1, 0])
  
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 33 for calling the TestVarianceForecasts obj's underlying member method code with example usage: obj.test_aparch_one_step() without return types