code: def test_init():
      # Test initialization of the params
  
      # Basic test, with 1 of each parameter
      exog = pd.DataFrame([[0]], columns=["a"])
      spec = specification.SARIMAXSpecification(
          exog=exog, order=(1, 1, 1), seasonal_order=(1, 1, 1, 4)
      )
      p = params.SARIMAXParams(spec=spec)
  
      # Test things copied over from spec
      assert_equal(p.spec, spec)
      assert_equal(p.exog_names, ["a"])
      assert_equal(p.ar_names, ["ar.L1"])
      assert_equal(p.ma_names, ["ma.L1"])
      assert_equal(p.seasonal_ar_names, ["ar.S.L4"])
      assert_equal(p.seasonal_ma_names, ["ma.S.L4"])
      assert_equal(
          p.param_names,
          ["a", "ar.L1", "ma.L1", "ar.S.L4", "ma.S.L4", "sigma2"],
      )
  
      assert_equal(p.k_exog_params, 1)
      assert_equal(p.k_ar_params, 1)
      assert_equal(p.k_ma_params, 1)
      assert_equal(p.k_seasonal_ar_params, 1)
      assert_equal(p.k_seasonal_ma_params, 1)
      assert_equal(p.k_params, 6)
  
      # Initial parameters should all be NaN
      assert_equal(p.params, np.nan)
      assert_equal(p.ar_params, [np.nan])
      assert_equal(p.ma_params, [np.nan])
      assert_equal(p.seasonal_ar_params, [np.nan])
      assert_equal(p.seasonal_ma_params, [np.nan])
      assert_equal(p.sigma2, np.nan)
      assert_equal(p.ar_poly.coef, np.r_[1, np.nan])
      assert_equal(p.ma_poly.coef, np.r_[1, np.nan])
      assert_equal(p.seasonal_ar_poly.coef, np.r_[1, 0, 0, 0, np.nan])
      assert_equal(p.seasonal_ma_poly.coef, np.r_[1, 0, 0, 0, np.nan])
      assert_equal(p.reduced_ar_poly.coef, np.r_[1, [np.nan] * 5])
      assert_equal(p.reduced_ma_poly.coef, np.r_[1, [np.nan] * 5])
  
      # Test other properties, methods
      assert_(not p.is_complete)
      assert_(not p.is_valid)
      assert_raises(ValueError, p.__getattribute__, "is_stationary")
      assert_raises(ValueError, p.__getattribute__, "is_invertible")
      desired = {
          "exog_params": [np.nan],
          "ar_params": [np.nan],
          "ma_params": [np.nan],
          "seasonal_ar_params": [np.nan],
          "seasonal_ma_params": [np.nan],
          "sigma2": np.nan,
      }
      assert_equal(p.to_dict(), desired)
      desired = pd.Series(
          [np.nan] * spec.k_params, index=spec.param_names
      )
      assert_allclose(p.to_pandas(), desired)
  
      # Test with different numbers of parameters for each
      exog = pd.DataFrame([[0, 0]], columns=["a", "b"])
      spec = specification.SARIMAXSpecification(
          exog=exog, order=(3, 1, 2), seasonal_order=(5, 1, 6, 4)
      )
      p = params.SARIMAXParams(spec=spec)
      # No real need to test names here, since they are already tested above for
      # the 1-param case, and tested more extensively in test for
      # SARIMAXSpecification
      assert_equal(p.k_exog_params, 2)
      assert_equal(p.k_ar_params, 3)
      assert_equal(p.k_ma_params, 2)
      assert_equal(p.k_seasonal_ar_params, 5)
      assert_equal(p.k_seasonal_ma_params, 6)
      assert_equal(p.k_params, 2 + 3 + 2 + 5 + 6 + 1)
  
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 1 for calling a global function with example usage: test_init() without return types