code: def test_set_params_single_nonconsecutive():
      # Test setting parameters directly (i.e. we test setting the AR/MA
      # parameters by setting the lag polynomials elsewhere)
      # Here each type has only a single parameters but has non-consecutive
      # lag orders
      exog = pd.DataFrame([[0]], columns=["a"])
      spec = specification.SARIMAXSpecification(
          exog=exog,
          order=([0, 1], 1, [0, 1]),
          seasonal_order=([0, 1], 1, [0, 1], 4),
      )
      p = params.SARIMAXParams(spec=spec)
  
      def check(is_stationary="raise", is_invertible="raise"):
          assert_(not p.is_complete)
          assert_(not p.is_valid)
          if is_stationary == "raise":
              assert_raises(
                  ValueError, p.__getattribute__, "is_stationary"
              )
          else:
              assert_equal(p.is_stationary, is_stationary)
          if is_invertible == "raise":
              assert_raises(
                  ValueError, p.__getattribute__, "is_invertible"
              )
          else:
              assert_equal(p.is_invertible, is_invertible)
  
      # Set params one at a time, as scalars
      p.exog_params = -6.0
      check()
      p.ar_params = -5.0
      check()
      p.ma_params = -4.0
      check()
      p.seasonal_ar_params = -3.0
      check(is_stationary=False)
      p.seasonal_ma_params = -2.0
      check(is_stationary=False, is_invertible=False)
      p.sigma2 = -1.0
      # Finally, we have a complete set.
      assert_(p.is_complete)
      # But still not valid
      assert_(not p.is_valid)
  
      assert_equal(p.params, [-6, -5, -4, -3, -2, -1])
      assert_equal(p.exog_params, [-6])
      assert_equal(p.ar_params, [-5])
      assert_equal(p.ma_params, [-4])
      assert_equal(p.seasonal_ar_params, [-3])
      assert_equal(p.seasonal_ma_params, [-2])
      assert_equal(p.sigma2, -1.0)
  
      # Lag polynomials
      assert_equal(p.ar_poly.coef, [1, 0, 5])
      assert_equal(p.ma_poly.coef, [1, 0, -4])
      assert_equal(p.seasonal_ar_poly.coef, [1, 0, 0, 0, 0, 0, 0, 0, 3])
      assert_equal(
          p.seasonal_ma_poly.coef, [1, 0, 0, 0, 0, 0, 0, 0, -2]
      )
      # (1 - a L^2) (1 - b L^8) = (1 - a L^2 - b L^8 + a b L^10)
      assert_equal(
          p.reduced_ar_poly.coef, [1, 0, 5, 0, 0, 0, 0, 0, 3, 0, 15]
      )
      # (1 + a L^2) (1 + b L^4) = (1 + a L^2 + b L^8 + a b L^10)
      assert_equal(
          p.reduced_ma_poly.coef, [1, 0, -4, 0, 0, 0, 0, 0, -2, 0, 8]
      )
  
      # Override again, now setting params all at once
      p.params = [1, 2, 3, 4, 5, 6]
      assert_equal(p.params, [1, 2, 3, 4, 5, 6])
      assert_equal(p.exog_params, [1])
      assert_equal(p.ar_params, [2])
      assert_equal(p.ma_params, [3])
      assert_equal(p.seasonal_ar_params, [4])
      assert_equal(p.seasonal_ma_params, [5])
      assert_equal(p.sigma2, 6.0)
  
      # Lag polynomials
      assert_equal(p.ar_poly.coef, np.r_[1, 0, -2])
      assert_equal(p.ma_poly.coef, np.r_[1, 0, 3])
      assert_equal(
          p.seasonal_ar_poly.coef, [1, 0, 0, 0, 0, 0, 0, 0, -4]
      )
      assert_equal(p.seasonal_ma_poly.coef, [1, 0, 0, 0, 0, 0, 0, 0, 5])
      # (1 - a L^2) (1 - b L^8) = (1 - a L^2 - b L^8 + a b L^10)
      assert_equal(
          p.reduced_ar_poly.coef, [1, 0, -2, 0, 0, 0, 0, 0, -4, 0, 8]
      )
      # (1 + a L^2) (1 + b L^4) = (1 + a L^2 + b L^8 + a b L^10)
      assert_equal(
          p.reduced_ma_poly.coef, [1, 0, 3, 0, 0, 0, 0, 0, 5, 0, 15]
      )
  
file_path: statsmodels/statsmodels/tsa/arima/tests/test_params.py
imports: import numpy
  import pandas
  from numpy.testing import assert_, assert_equal, assert_allclose, assert_raises
  from statsmodels.tsa.arima import specification, params
label_desc: Use image node_id 3 for calling a global function with example usage: test_set_params_single_nonconsecutive() without return types