code: def test_midas_asymmetric(setup):
      midas = MIDASHyperbolic(33, asym=True)
  
      sv = midas.starting_values(setup.resids)
      assert_equal(sv.shape[0], midas.num_params)
  
      bounds = midas.bounds(setup.resids)
      assert_equal(
          bounds[0], (0.0, 10.0 * np.mean(setup.resids**2.0))
      )
      assert_equal(bounds[1], (0.0, 1.0))
      assert_equal(bounds[2], (-1.0, 2.0))
      assert_equal(bounds[3], (0.0, 1.0))
      backcast = midas.backcast(setup.resids)
      w = 0.94 ** np.arange(75)
      assert_almost_equal(
          backcast, np.sum((setup.resids[:75] ** 2) * (w / w.sum()))
      )
      var_bounds = midas.variance_bounds(setup.resids)
      parameters = np.array([0.1, 0.3, 1.2, 0.4])
      midas.compute_variance(
          parameters, setup.resids, setup.sigma2, backcast, var_bounds
      )
      cond_var_direct = np.zeros_like(setup.sigma2)
      weights = midas._weights(parameters)
      wlen = len(weights)
      theta = parameters[-1]
      j = np.arange(1, wlen + 1)
      direct_weights = (
          gammaln(j + theta) - gammaln(j + 1) - gammaln(theta)
      )
      direct_weights = np.exp(direct_weights)
      direct_weights = direct_weights / direct_weights.sum()
      assert_allclose(direct_weights, weights)
      resids = setup.resids
      direct_params = parameters[:3].copy()
      recpy.midas_recursion_python(
          direct_params,
          weights,
          resids,
          cond_var_direct,
          setup.t,
          backcast,
          var_bounds,
      )
      assert_allclose(setup.sigma2, cond_var_direct)
  
      a, b = midas.constraints()
      a_target = np.zeros((5, 4))
      a_target[0, 0] = 1
      a_target[1, 1] = 1
      a_target[1, 2] = 1
      a_target[2, 1] = -1
      a_target[2, 2] = -0.5
      a_target[3, 3] = 1
      a_target[4, 3] = -1
      b_target = np.array([0.0, 0.0, -1.0, 0.0, -1.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)
      burn = wlen
      sim_data = midas.simulate(
          parameters, setup.t, rng.simulate([]), burn=burn
      )
      setup.rng.set_state(state)
      e = setup.rng.standard_normal(setup.t + burn)
      initial_value = 1.0
      sigma2 = np.zeros(setup.t + burn)
      data = np.zeros(setup.t + burn)
      sigma2[:wlen] = initial_value
      omega, alpha, gamma = parameters[:3]
      for t in range(wlen, setup.t + burn):
          sigma2[t] = omega
          for i in range(wlen):
              if t - i - 1 < wlen:
                  shock = initial_value
                  coeff = (alpha + 0.5 * gamma) * weights[i]
              else:
                  shock = data[t - i - 1] ** 2.0
                  coeff = (
                      alpha + gamma * (data[t - i - 1] < 0)
                  ) * weights[i]
              sigma2[t] += coeff * shock
          data[t] = e[t] * np.sqrt(sigma2[t])
      data = data[burn:]
      sigma2 = sigma2[burn:]
      assert_almost_equal(data / sim_data[0], np.ones_like(data))
      assert_almost_equal(sigma2 / sim_data[1], np.ones_like(sigma2))
  
      names = midas.parameter_names()
      names_target = ["omega", "alpha", "gamma", "theta"]
      assert_equal(names, names_target)
  
      assert isinstance(midas.__str__(), str)
      txt = midas.__repr__()
      assert str(hex(id(midas))) in txt
  
      assert_equal(midas.name, "MIDAS Hyperbolic")
      assert_equal(midas.num_params, 4)
      assert_equal(midas.m, 33)
  
      with pytest.warns(InitialValueWarning):
          parameters = np.array([0.1, 0.3, 1.6, 0.4])
          midas.simulate(parameters, setup.t, 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 25 for calling a global function with example usage: test_midas_asymmetric(setup) without return types