code: def test_garch(self):
      nobs, resids = self.nobs, self.resids
      sigma2, backcast = self.sigma2, self.backcast
  
      parameters = np.array([0.1, 0.4, 0.3, 0.2])
      fresids = resids**2.0
      sresids = np.sign(resids)
  
      recpy.garch_recursion(
          parameters,
          fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      sigma2_numba = sigma2.copy()
      recpy.garch_recursion_python(
          parameters,
          fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      sigma2_python = sigma2.copy()
      rec.garch_recursion(
          parameters,
          fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      assert_almost_equal(sigma2_numba, sigma2)
      assert_almost_equal(sigma2_python, sigma2)
  
      parameters = np.array([0.1, -0.4, 0.3, 0.2])
      recpy.garch_recursion_python(
          parameters,
          fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      assert np.all(sigma2 >= self.var_bounds[:, 0])
      assert np.all(sigma2 <= 1.1 * self.var_bounds[:, 1])
  
      parameters = np.array([0.1, 0.4, 3, 2])
      recpy.garch_recursion_python(
          parameters,
          fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      assert np.all(sigma2 >= self.var_bounds[:, 0])
      assert np.all(sigma2 <= 1.1 * self.var_bounds[:, 1])
  
      parameters = np.array([0.1, 0.4, 0.3, 0.2])
      mod_fresids = fresids.copy()
      mod_fresids[:1] = np.inf
      recpy.garch_recursion_python(
          parameters,
          mod_fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      assert np.all(sigma2 >= self.var_bounds[:, 0])
      assert np.all(sigma2 <= 1.1 * self.var_bounds[:, 1])
      rec.garch_recursion(
          parameters,
          mod_fresids,
          sresids,
          sigma2,
          1,
          1,
          1,
          nobs,
          backcast,
          self.var_bounds,
      )
      assert np.all(sigma2 >= self.var_bounds[:, 0])
      assert np.all(sigma2 <= 1.1 * self.var_bounds[:, 1])
  
imports: import os
  import pickle
  import timeit
  import types
  import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose, assert_almost_equal
  import pytest
  from scipy.special import gamma
  import arch.univariate.recursions_python
  from arch.univariate.volatility import RiskMetrics2006
label_desc: Use image node_id 2 for calling the TestRecursions obj's underlying member method code with example usage: obj.test_garch() without return types