code: def test_ewma_estimated(setup, initial_value):
      ewma = EWMAVariance(lam=None)
  
      sv = ewma.starting_values(setup.resids)
      assert sv == 0.94
      assert sv.shape[0] == ewma.num_params
  
      bounds = ewma.bounds(setup.resids)
      assert len(bounds) == 1
      assert bounds == [(0, 1)]
  
      ewma.variance_bounds(setup.resids)
  
      backcast = ewma.backcast(setup.resids)
      w = 0.94 ** np.arange(75)
      assert_almost_equal(
          backcast, np.sum((setup.resids[:75] ** 2) * (w / w.sum()))
      )
  
      parameters = np.array([0.9234])
  
      var_bounds = ewma.variance_bounds(setup.resids)
      ewma.compute_variance(
          parameters, setup.resids, setup.sigma2, backcast, var_bounds
      )
      cond_var_direct = np.zeros_like(setup.sigma2)
      cond_var_direct[0] = backcast
      parameters = np.array([0, 1 - parameters[0], parameters[0]])
      rec.garch_recursion(
          parameters,
          setup.resids**2.0,
          np.sign(setup.resids),
          cond_var_direct,
          1,
          0,
          1,
          setup.t,
          backcast,
          var_bounds,
      )
      assert_allclose(setup.sigma2, cond_var_direct)
      assert_allclose(
          setup.sigma2 / cond_var_direct, np.ones_like(setup.sigma2)
      )
  
      names = ewma.parameter_names()
      names_target = ["lam"]
      assert_equal(names, names_target)
  
      a, b = ewma.constraints()
      a_target = np.ones((1, 1))
      b_target = np.zeros((1,))
      assert_array_equal(a, a_target)
      assert_array_equal(b, b_target)
  
      assert_equal(ewma.num_params, 1)
      assert_equal(ewma.name, "EWMA/RiskMetrics")
      assert isinstance(ewma.__str__(), str)
      txt = ewma.__repr__()
      assert str(hex(id(ewma))) in txt
  
      state = setup.rng.get_state()
      rng = Normal(seed=RandomState())
      rng.generator.set_state(state)
      lam = parameters[-1]
      sim_data = ewma.simulate(
          [lam], setup.t, rng.simulate([]), initial_value=initial_value
      )
      setup.rng.set_state(state)
      e = setup.rng.standard_normal(setup.t + 500)
      initial_value = 1.0
  
      sigma2 = np.zeros(setup.t + 500)
      data = np.zeros(setup.t + 500)
      sigma2[0] = initial_value
      data[0] = np.sqrt(initial_value)
      for t in range(1, setup.t + 500):
          sigma2[t] = (
              lam * sigma2[t - 1] + (1 - lam) * data[t - 1] ** 2.0
          )
          data[t] = e[t] * np.sqrt(sigma2[t])
  
      data = data[500:]
      sigma2 = sigma2[500:]
      assert_almost_equal(data - sim_data[0] + 1.0, np.ones_like(data))
      assert_almost_equal(sigma2 / sim_data[1], np.ones_like(sigma2))
  
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 19 for calling a global function with example usage: test_ewma_estimated(setup, initial_value) without return types