code: def test_initial_probabilities():
      endog = np.ones(10)
      mod = markov_switching.MarkovSwitching(endog, k_regimes=2)
      params = np.r_[0.5, 0.5, 1.0]
  
      # Valid known initial probabilities
      mod.initialize_known([0.2, 0.8])
      assert_allclose(mod.initial_probabilities(params), [0.2, 0.8])
  
      # Invalid known initial probabilities (too many elements)
      assert_raises(ValueError, mod.initialize_known, [0.2, 0.2, 0.6])
  
      # Invalid known initial probabilities (does not sum to 1)
      assert_raises(ValueError, mod.initialize_known, [0.2, 0.2])
  
      # Valid steady-state probabilities
      mod.initialize_steady_state()
      assert_allclose(mod.initial_probabilities(params), [0.5, 0.5])
  
      # Invalid steady-state probabilities (when mod has tvtp)
      endog = np.ones(10)
      mod = markov_switching.MarkovSwitching(
          endog, k_regimes=2, exog_tvtp=endog
      )
      assert_raises(ValueError, mod.initialize_steady_state)
  
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 5 for calling a global function with example usage: test_initial_probabilities() without return types