code: def test_varmax():
      steps = 10
  
      # Clear warnings
      varmax.__warningregistry__ = {}
  
      # VAR(2) - single series
      mod1 = varmax.VARMAX([[0]], order=(2, 0), trend="n")
      mod2 = sarimax.SARIMAX([0], order=(2, 0, 0))
      actual = mod1.impulse_responses([0.5, 0.2, 1], steps)
      desired = mod2.impulse_responses([0.5, 0.2, 1], steps)
      assert_allclose(actual, desired)
  
      # VMA(2) - single series
      mod1 = varmax.VARMAX([[0]], order=(0, 2), trend="n")
      mod2 = sarimax.SARIMAX([0], order=(0, 0, 2))
      actual = mod1.impulse_responses([0.5, 0.2, 1], steps)
      desired = mod2.impulse_responses([0.5, 0.2, 1], steps)
      assert_allclose(actual, desired)
  
      # VARMA(2, 2) - single series
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          mod1 = varmax.VARMAX([[0]], order=(2, 2), trend="n")
      mod2 = sarimax.SARIMAX([0], order=(2, 0, 2))
      actual = mod1.impulse_responses([0.5, 0.2, 0.1, -0.2, 1], steps)
      desired = mod2.impulse_responses([0.5, 0.2, 0.1, -0.2, 1], steps)
      assert_allclose(actual, desired)
  
      # VARMA(2, 2) + trend - single series
      warning = EstimationWarning
      match = r"VARMA\(p,q\) models is not"
      with pytest.warns(warning, match=match):
          mod1 = varmax.VARMAX([[0]], order=(2, 2), trend="c")
      mod2 = sarimax.SARIMAX([0], order=(2, 0, 2), trend="c")
      actual = mod1.impulse_responses(
          [10, 0.5, 0.2, 0.1, -0.2, 1], steps
      )
      desired = mod2.impulse_responses(
          [10, 0.5, 0.2, 0.1, -0.2, 1], steps
      )
      assert_allclose(actual, desired)
  
      # VAR(2) + constant
      # Stata:
      # webuse lutkepohl2
      # var dln_inv dln_inc, lags(1/2)
      # irf create irf3, set(irf3) step(10)
      # irf table irf
      # irf table oirf
      params = [
          -0.00122728,
          0.01503679,
          -0.22741923,
          0.71030531,
          -0.11596357,
          0.51494891,
          0.05974659,
          0.02094608,
          0.05635125,
          0.08332519,
          0.04297918,
          0.00159473,
          0.01096298,
      ]
      irf_00 = [
          1,
          -0.227419,
          -0.021806,
          0.093362,
          -0.001875,
          -0.00906,
          0.009605,
          0.001323,
          -0.001041,
          0.000769,
          0.00032,
      ]
      irf_01 = [
          0,
          0.059747,
          0.044015,
          -0.008218,
          0.007845,
          0.004629,
          0.000104,
          0.000451,
          0.000638,
          0.000063,
          0.000042,
      ]
      irf_10 = [
          0,
          0.710305,
          0.36829,
          -0.065697,
          0.084398,
          0.043038,
          0.000533,
          0.005755,
          0.006051,
          0.000548,
          0.000526,
      ]
      irf_11 = [
          1,
          0.020946,
          0.126202,
          0.066419,
          0.028735,
          0.007477,
          0.009878,
          0.003287,
          0.001266,
          0.000986,
          0.0005,
      ]
      oirf_00 = [
          0.042979,
          -0.008642,
          -0.00035,
          0.003908,
          0.000054,
          -0.000321,
          0.000414,
          0.000066,
          -0.000035,
          0.000034,
          0.000015,
      ]
      oirf_01 = [
          0.001595,
          0.002601,
          0.002093,
          -0.000247,
          0.000383,
          0.000211,
          0.00002,
          0.000025,
          0.000029,
          4.30e-06,
          2.60e-06,
      ]
      oirf_10 = [
          0,
          0.007787,
          0.004037,
          -0.00072,
          0.000925,
          0.000472,
          5.80e-06,
          0.000063,
          0.000066,
          6.00e-06,
          5.80e-06,
      ]
      oirf_11 = [
          0.010963,
          0.00023,
          0.001384,
          0.000728,
          0.000315,
          0.000082,
          0.000108,
          0.000036,
          0.000014,
          0.000011,
          5.50e-06,
      ]
  
      mod = varmax.VARMAX([[0, 0]], order=(2, 0), trend="c")
  
      # IRFs
      actual = mod.impulse_responses(params, steps, impulse=0)
      assert_allclose(actual, np.c_[irf_00, irf_01], atol=1e-6)
  
      actual = mod.impulse_responses(params, steps, impulse=1)
      assert_allclose(actual, np.c_[irf_10, irf_11], atol=1e-6)
  
      # Orthogonalized IRFs
      actual = mod.impulse_responses(
          params, steps, impulse=0, orthogonalized=True
      )
      assert_allclose(actual, np.c_[oirf_00, oirf_01], atol=1e-6)
  
      actual = mod.impulse_responses(
          params, steps, impulse=1, orthogonalized=True
      )
      assert_allclose(actual, np.c_[oirf_10, oirf_11], atol=1e-6)
  
      # Impulse response passing column name
      data = get_macrodata().view((float, 3), type=np.ndarray)
  
      df = pd.DataFrame(
          {"a": data[:, 0], "b": data[:, 1], "c": data[:, 2]}
      )
  
      mod1 = varmax.VARMAX(df, order=(1, 0), trend="c")
      mod1_result = mod1.fit()
      mod2 = varmax.VARMAX(data, order=(1, 0), trend="c")
      mod2_result = mod2.fit()
  
      with pytest.raises(
          ValueError, match="Endog must be pd.DataFrame."
      ):
          mod2_result.impulse_responses(6, impulse="b")
  
      response1 = mod1_result.impulse_responses(6, impulse="b")
      response2 = mod1_result.impulse_responses(6, impulse=[0, 1, 0])
      assert_allclose(response1, response2)
  
      # VARMA(2, 2) + trend + exog
      # TODO: This is just a smoke test
      with warnings.catch_warnings():
          warnings.simplefilter("ignore")
          mod = varmax.VARMAX(
              np.random.normal(size=(steps, 2)),
              order=(2, 2),
              trend="c",
              exog=np.ones(steps),
              enforce_stationarity=False,
              enforce_invertibility=False,
          )
      mod.impulse_responses(mod.start_params, steps)
  
imports: from statsmodels.compat.pandas import MONTH_END
  import warnings
  import numpy
  from numpy.testing import assert_, assert_allclose
  import pandas
  import pytest
  from scipy.stats import ortho_group
  from statsmodels.tools.sm_exceptions import EstimationWarning
  from statsmodels.tsa.statespace import dynamic_factor, mlemodel, sarimax, structural, varmax
  from statsmodels.tsa.vector_ar.tests.test_var import get_macrodata
label_desc: Use image node_id 3 for calling a global function with example usage: test_varmax() without return types