code: def test_tarch_111_forecast_bootstrap(self):
      t = self.t
      vol = GARCH(p=1, o=1, q=1, power=1.0)
      dist = StudentsT(seed=self.rng)
      rng = dist.simulate([8.0])
      params = np.array([3.0, 0.1, 0.1, 0.80])
      resids = self.resid
      backcast = vol.backcast(resids)
      var_bounds = vol.variance_bounds(resids, power=1.0)
      sigma2 = np.zeros(t)
      vol.compute_variance(params, resids, sigma2, backcast, var_bounds)
      with preserved_state(self.rng):
          forecast = vol.forecast(
              params,
              self.resid,
              backcast,
              var_bounds,
              horizon=10,
              start=100,
              rng=rng,
              method="bootstrap",
              random_state=self.rng,
          )
  
      std_resids = resids / np.sqrt(sigma2)
  
      one_step = vol.forecast(
          params, self.resid, backcast, var_bounds, horizon=1, start=100
      )
      paths = np.zeros((1000, 10))
      shocks = np.zeros((1000, 10))
      for j in range(100, t):
          locs = self.rng.random_sample((1000, 10))
          int_locs = np.floor(locs * (j + 1)).astype(np.int_)
          std_shocks = std_resids[int_locs]
  
          paths[:, 0] = one_step.forecasts[j - 100, 0]
          shocks[:, 0] = std_shocks[:, 0] * np.sqrt(paths[:, 0])
          sqrt_path = np.sqrt(paths[:, 0])
          for i in range(1, 10):
              abs_err = np.abs(shocks[:, i - 1])
              err_neg = shocks[:, i - 1] < 0
              sqrt_path = (
                  params[0]
                  + params[1] * abs_err
                  + params[2] * abs_err * err_neg
                  + params[3] * sqrt_path
              )
              paths[:, i] = sqrt_path**2
              shocks[:, i] = sqrt_path * std_shocks[:, i]
          assert_allclose(shocks, forecast.shocks[j - 100])
          assert_allclose(paths.mean(0), forecast.forecasts[j - 100])
          assert_allclose(paths, forecast.forecast_paths[j - 100])
  
      with pytest.raises(ValueError):
          vol.forecast(
              params,
              self.resid,
              backcast,
              var_bounds,
              horizon=2,
              start=20,
              rng=rng,
              method="bootstrap",
              random_state=self.rng,
          )
      with pytest.raises(ValueError):
          vol.forecast(
              params, self.resid, backcast, var_bounds, method="unknown"
          )
  
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 15 for calling the TestVarianceForecasts obj's underlying member method code with example usage: obj.test_tarch_111_forecast_bootstrap() without return types