code: def test_garch11_bootstrap(self):
      t = self.t
      vol = GARCH(p=1, o=0, q=1)
      params = np.array([10.0, 0.1, 0.85])
      backcast = vol.backcast(self.resid)
      var_bounds = vol.variance_bounds(self.resid)
      with preserved_state(self.rng):
          forecast = vol.forecast(
              params,
              self.resid,
              backcast,
              var_bounds,
              horizon=10,
              method="bootstrap",
              start=100,
              random_state=self.rng,
          )
  
      paths = np.empty((t, 1000, 10))
      paths.fill(np.nan)
      shocks = np.empty((t, 1000, 10))
      shocks.fill(np.nan)
  
      _sigma2 = np.empty(t + 1)
      _resids = np.concatenate((self.resid, [0]))
      _var_bounds = np.concatenate((var_bounds, [[0, np.inf]]))
      vol.compute_variance(
          params, _resids, _sigma2, backcast, _var_bounds
      )
      std_resid = self.resid / np.sqrt(_sigma2[:-1])
      one_step = _sigma2[1:]
      omega, alpha, beta = params
      for i in range(100, t):
          locs = np.floor(
              (i + 1) * self.rng.random_sample((1000, 10))
          ).astype(np.int64)
          std_shocks = std_resid[locs]
          paths[i, :, 0] = one_step[i]
          shocks[i, :, 0] = np.sqrt(paths[i, :, 0]) * std_shocks[:, 0]
          for j in range(1, 10):
              paths[i, :, j] = (
                  omega
                  + alpha * shocks[i, :, j - 1] ** 2.0
                  + beta * paths[i, :, j - 1]
              )
              shocks[i, :, j] = (
                  np.sqrt(paths[i, :, j]) * std_shocks[:, j]
              )
  
      assert_allclose(forecast.forecasts, paths[100:].mean(1))
      assert_allclose(forecast.forecast_paths, paths[100:])
      assert_allclose(forecast.shocks, shocks[100:])
  
      with preserved_state(self.rng):
          forecast = vol.forecast(
              params,
              self.resid,
              backcast,
              var_bounds,
              horizon=10,
              method="bootstrap",
              simulations=2000,
              start=100,
          )
  
      assert forecast.forecasts.shape == (t - 100, 10)
      assert forecast.forecast_paths.shape == (t - 100, 2000, 10)
      assert forecast.shocks.shape == (t - 100, 2000, 10)
  
      assert np.all(np.isfinite(forecast.forecasts))
      assert np.all(np.isfinite(forecast.forecast_paths))
      assert np.all(np.isfinite(forecast.shocks))
  
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 25 for calling the TestVarianceForecasts obj's underlying member method code with example usage: obj.test_garch11_bootstrap() without return types