code: def test_params():
      def check_transtion_2(params):
          assert_equal(params["regime_transition"], np.s_[0:2])
          assert_equal(params[0, "regime_transition"], [0])
          assert_equal(params[1, "regime_transition"], [1])
          assert_equal(params["regime_transition", 0], [0])
          assert_equal(params["regime_transition", 1], [1])
  
      def check_transition_3(params):
          assert_equal(params["regime_transition"], np.s_[0:6])
          assert_equal(params[0, "regime_transition"], [0, 3])
          assert_equal(params[1, "regime_transition"], [1, 4])
          assert_equal(params[2, "regime_transition"], [2, 5])
          assert_equal(params["regime_transition", 0], [0, 3])
          assert_equal(params["regime_transition", 1], [1, 4])
          assert_equal(params["regime_transition", 2], [2, 5])
  
      params = markov_switching.MarkovSwitchingParams(k_regimes=2)
      params["regime_transition"] = [1]
      assert_equal(params.k_params, 1 * 2)
      assert_equal(params[0], [0])
      assert_equal(params[1], [1])
      check_transtion_2(params)
  
      params["exog"] = [0, 1]
      assert_equal(params.k_params, 1 * 2 + 1 + 1 * 2)
      assert_equal(params[0], [0, 2, 3])
      assert_equal(params[1], [1, 2, 4])
      check_transtion_2(params)
      assert_equal(params["exog"], np.s_[2:5])
      assert_equal(params[0, "exog"], [2, 3])
      assert_equal(params[1, "exog"], [2, 4])
      assert_equal(params["exog", 0], [2, 3])
      assert_equal(params["exog", 1], [2, 4])
  
      params = markov_switching.MarkovSwitchingParams(k_regimes=3)
      params["regime_transition"] = [1, 1]
      assert_equal(params.k_params, 2 * 3)
      assert_equal(params[0], [0, 3])
      assert_equal(params[1], [1, 4])
      assert_equal(params[2], [2, 5])
      check_transition_3(params)
  
      # Test for invalid parameter setting
      assert_raises(IndexError, params.__setitem__, None, [1, 1])
  
      # Test for invalid parameter selection
      assert_raises(IndexError, params.__getitem__, None)
      assert_raises(IndexError, params.__getitem__, (0, 0))
      assert_raises(IndexError, params.__getitem__, ("exog", "exog"))
      assert_raises(IndexError, params.__getitem__, ("exog", 0, 1))
  
file_path: statsmodels/statsmodels/tsa/regime_switching/tests/test_markov_switching.py
imports: import numpy
  from numpy.testing import assert_equal, assert_allclose, assert_raises
  import pandas
  from statsmodels.tools.numdiff import approx_fprime_cs
  from statsmodels.tsa.regime_switching import markov_switching
label_desc: Use image node_id 1 for calling a global function with example usage: test_params() without return types