code: def test_rm_2006(self):
      rm2006 = RiskMetrics2006()
      params = np.empty(0)
      resids = self.resids
      sigma2 = self.sigma2
      nobs = self.nobs
      backcast = rm2006.backcast(self.resids)
      rm2006.compute_variance(
          params, resids, sigma2, backcast, self.var_bounds
      )
  
      sigma2_ref = sigma2.copy()
      sigma2[:] = np.nan
      cw = rm2006._ewma_combination_weights()
      sp = rm2006._ewma_smoothing_parameters()
      ru = recpy.RiskMetrics2006Updater(rm2006.kmax, cw, sp)
      ru.initialize_update(None, backcast, None)
      for t in range(nobs):
          ru._update_tester(t, params, resids, sigma2, self.var_bounds)
          if t == nobs // 2:
              ru = pickle.loads(pickle.dumps(ru))
      ru.initialize_update(None, backcast, None)
      assert_allclose(sigma2, sigma2_ref)
      sigma2_py = sigma2.copy()
  
      sigma2[:] = np.nan
      ru = rec.RiskMetrics2006Updater(rm2006.kmax, cw, sp)
      ru.initialize_update(None, backcast, None)
      for t in range(nobs):
          ru._update_tester(t, params, resids, sigma2, self.var_bounds)
          if t == nobs // 2:
              ru = pickle.loads(pickle.dumps(ru))
      ru.initialize_update(None, backcast, None)
      ru.initialize_update(None, 3.0, None)
      assert_allclose(sigma2, sigma2_py)
  
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 28 for calling the TestRecursions obj's underlying member method code with example usage: obj.test_rm_2006() without return types