code: def test_figarch(setup, initial_value):
      trunc_lag = 750
      figarch = FIGARCH(truncation=trunc_lag)
  
      sv = figarch.starting_values(setup.resids)
      assert_equal(sv.shape[0], figarch.num_params)
  
      bounds = figarch.bounds(setup.resids)
      assert_equal(
          bounds[0], (0.0, 10.0 * np.mean(setup.resids**2.0))
      )
      assert_equal(bounds[1], (0.0, 0.5))
      assert_allclose(
          np.array(bounds[2]), np.array([0.0, 1 - EPS_HALF])
      )
      assert_allclose(
          np.array(bounds[3]), np.array([0.0, 1 - EPS_HALF])
      )
      assert len(bounds) == figarch.num_params
  
      backcast = figarch.backcast(setup.resids)
      w = 0.94 ** np.arange(75)
      assert_almost_equal(
          backcast, np.sum((setup.resids[:75] ** 2) * (w / w.sum()))
      )
      var_bounds = figarch.variance_bounds(setup.resids)
      parameters = np.array([1, 0.2, 0.4, 0.2])
      figarch.compute_variance(
          parameters, setup.resids, setup.sigma2, backcast, var_bounds
      )
  
      cond_var_direct = np.zeros_like(setup.sigma2)
      fresids = setup.resids**2
      p = q = 1
      nobs = setup.resids.shape[0]
      recpy.figarch_recursion_python(
          parameters,
          fresids,
          cond_var_direct,
          p,
          q,
          nobs,
          trunc_lag,
          backcast,
          var_bounds,
      )
      assert_allclose(setup.sigma2, cond_var_direct)
  
      a, b = figarch.constraints()
      a_target = np.zeros((7, 4))
      a_target[0, 0] = 1
      a_target[1, 1] = 1
      a_target[2, 1] = -2
      a_target[2, 2] = -1
      a_target[3, 2] = 1
      a_target[4, 2] = -1
      a_target[5, 3] = 1
      a_target[6, 1] = 1
      a_target[6, 2] = 1
      a_target[6, 3] = -1
      b_target = np.array([0.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0])
      assert_array_equal(a, a_target)
      assert_array_equal(b, b_target)
  
      state = setup.rng.get_state()
      rng = Normal(seed=RandomState())
      rng.generator.set_state(state)
      sim_data = figarch.simulate(parameters, setup.t, rng.simulate([]))
      setup.rng.set_state(state)
      lam = rec.figarch_weights(parameters[1:], p, q, trunc_lag)
      lam_rev = lam[::-1]
      omega_tilde = parameters[0] / (1 - parameters[-1])
      initial_value = omega_tilde / (1 - lam.sum())
      e = setup.rng.standard_normal(trunc_lag + setup.t + 500)
      sigma2 = np.zeros(trunc_lag + setup.t + 500)
      data = np.zeros(trunc_lag + setup.t + 500)
      sigma2[:trunc_lag] = initial_value
      data[:trunc_lag] = np.sqrt(sigma2[:trunc_lag]) * e[:trunc_lag]
  
      for t in range(trunc_lag, trunc_lag + setup.t + 500):
          sigma2[t] = omega_tilde + lam_rev.dot(
              data[t - trunc_lag : t] ** 2
          )
          data[t] = e[t] * np.sqrt(sigma2[t])
      data = data[trunc_lag + 500 :]
      sigma2 = sigma2[trunc_lag + 500 :]
      assert_almost_equal(sigma2 / sim_data[1], np.ones_like(sigma2))
      assert_almost_equal(data / sim_data[0], np.ones_like(data))
  
      names = figarch.parameter_names()
      names_target = ["omega", "phi", "d", "beta"]
      assert_equal(names, names_target)
  
      assert isinstance(figarch.__str__(), str)
      txt = figarch.__repr__()
      assert str(hex(id(figarch))) in txt
  
      assert_equal(figarch.name, "FIGARCH")
      assert_equal(figarch.num_params, 4)
      assert_equal(figarch.truncation, trunc_lag)
  
      params = np.array([0.1, 1.01, 0.4, 1.005])
      with pytest.warns(InitialValueWarning):
          figarch.simulate(params, 20, rng.simulate([]))
  
imports: import types
  from typing import NamedTuple
  import warnings
  import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose, assert_almost_equal, assert_array_equal, assert_equal
  import pytest
  from scipy.special import gamma, gammaln
  from arch.univariate import ZeroMean
  from arch.univariate.distribution import Normal, SkewStudent, StudentsT
  import arch.univariate.recursions_python
  from arch.univariate.volatility import APARCH, ARCH, EGARCH, FIGARCH, GARCH, HARCH, ConstantVariance, EWMAVariance, FixedVariance, MIDASHyperbolic, RiskMetrics2006
  from arch.utility.exceptions import InitialValueWarning
label_desc: Use image node_id 26 for calling a global function with example usage: test_figarch(setup, initial_value) without return types