code: def test_filtered_regimes(self):
      res = self.result
      assert_equal(
          len(res.filtered_marginal_probabilities[:, 1]),
          self.model.nobs,
      )
      assert_allclose(
          res.filtered_marginal_probabilities[:, 1],
          hamilton_ar4_filtered,
          atol=1e-5,
      )
  
imports: import warnings
  import os
  import numpy
  from numpy.testing import assert_equal, assert_allclose
  import pandas
  import pytest
  from statsmodels.tools import add_constant
  from statsmodels.tsa.regime_switching import markov_autoregression
label_desc: Use image node_id 2 for calling the TestHamiltonAR4 obj's underlying member method code with example usage: obj.test_filtered_regimes() without return types