code: def test_em_nonstationary(reset_randomstate):
      # Test that when the EM algorithm estimates non-stationary parameters, that
      # it warns the user and switches to a diffuse initialization.
      ix = pd.period_range(start="2000", periods=20, freq="M")
      endog_M = pd.Series(np.arange(20), index=ix, dtype=float)
      endog_M.iloc[10:12] += [0.4, -0.2]  # add in a little noise
      ix = pd.period_range(start="2000", periods=5, freq="Q")
      endog_Q = pd.Series(np.arange(5), index=ix)
  
      mod = dynamic_factor_mq.DynamicFactorMQ(
          endog_M,
          endog_quarterly=endog_Q,
          idiosyncratic_ar1=False,
          standardize=False,
          factors=["global"],
      )
      msg = (
          "Non-stationary parameters found at EM iteration 1, which is not"
          " compatible with stationary initialization. Initialization was"
          r' switched to diffuse for the following:  \["factor block:'
          r' \(\'global\',\)"\], and fitting was restarted.'
      )
      with pytest.warns(UserWarning, match=msg):
          mod.fit(maxiter=2, em_initialization=False)
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_dynamic_factor_mq_monte_carlo.py
imports: from statsmodels.compat.pandas import QUARTER_END
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from scipy.signal import lfilter
  from statsmodels.tsa.statespace import dynamic_factor, dynamic_factor_mq, sarimax, varmax
label_desc: Use image node_id 5 for calling a global function with example usage: test_em_nonstationary(reset_randomstate) without return types