code: def test_arma_lfilter():
      # Tests of an ARMA model simulation against scipy.signal.lfilter
      # Note: the first elements of the generated SARIMAX datasets are based on
      # the initial state, so we do not include them in the comparisons
      np.random.seed(10239)
      nobs = 100
      eps = np.random.normal(size=nobs)
  
      # AR(1)
      mod = sarimax.SARIMAX([0], order=(1, 0, 0))
      actual = mod.simulate(
          [0.5, 1.0],
          nobs + 1,
          state_shocks=np.r_[eps, 0],
          initial_state=np.zeros(mod.k_states),
      )
      desired = lfilter([1], [1, -0.5], eps)
      assert_allclose(actual[1:], desired)
  
      # MA(1)
      mod = sarimax.SARIMAX([0], order=(0, 0, 1))
      actual = mod.simulate(
          [0.5, 1.0],
          nobs + 1,
          state_shocks=np.r_[eps, 0],
          initial_state=np.zeros(mod.k_states),
      )
      desired = lfilter([1, 0.5], [1], eps)
      assert_allclose(actual[1:], desired)
  
      # ARMA(1, 1)
      mod = sarimax.SARIMAX([0], order=(1, 0, 1))
      actual = mod.simulate(
          [0.5, 0.2, 1.0],
          nobs + 1,
          state_shocks=np.r_[eps, 0],
          initial_state=np.zeros(mod.k_states),
      )
      desired = lfilter([1, 0.2], [1, -0.5], eps)
      assert_allclose(actual[1:], desired)
  
imports: from statsmodels.compat.pandas import MONTH_END
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_equal
  import pandas
  import pytest
  from scipy.signal import lfilter
  from statsmodels.tools.sm_exceptions import EstimationWarning, SpecificationWarning
  from statsmodels.tsa.statespace import dynamic_factor, sarimax, structural, varmax
  from .test_impulse_responses import TVSS
label_desc: Use image node_id 1 for calling a global function with example usage: test_arma_lfilter() without return types