code: def test_idiosyncratic_ar1_False(reset_randomstate):
      # Test the case with idiosyncratic_ar1=False (which is not tested in
      # the test_dynamic_factor_mq_frbny_nowcast) by comparison to a model with
      # idiosyncratic_ar1=True but no actual serial correlation in the
      # idiosyncratic component
      endog, loadings, phi, sigma2, idio_ar1, idio_var = gen_dfm_data(
          k_endog=10, nobs=1000
      )
  
      # Create the baseline SARIMAX and the test Dynamic Factor MQ model
      mod_base = dynamic_factor.DynamicFactor(
          endog, k_factors=1, factor_order=1
      )
      mod_dfm = dynamic_factor_mq.DynamicFactorMQ(
          endog,
          factor_orders=1,
          standardize=False,
          idiosyncratic_ar1=False,
      )
      mod_dfm_ar1 = dynamic_factor_mq.DynamicFactorMQ(
          endog,
          factor_orders=1,
          standardize=False,
          idiosyncratic_ar1=True,
      )
  
      params = np.r_[loadings, idio_var, phi]
      params_dfm = np.r_[loadings, phi, sigma2, idio_var]
      params_dfm_ar1 = np.r_[loadings, phi, sigma2, idio_ar1, idio_var]
  
      # Test that these models all produce the same loglikelihood
      llf_base = mod_base.loglike(params)
      llf_dfm = mod_dfm.loglike(params_dfm)
      llf_dfm_ar1 = mod_dfm_ar1.loglike(params_dfm_ar1)
  
      assert_allclose(llf_dfm_ar1, llf_dfm)
      assert_allclose(llf_dfm, llf_base)
      assert_allclose(llf_dfm_ar1, llf_base)
  
      # Test that these methods produce the same smoothed estimates of the
      # idiosyncratic disturbance
      res0_dfm = mod_dfm.smooth(params_dfm)
      res0_dfm_ar1 = mod_dfm_ar1.smooth(params_dfm_ar1)
      assert_allclose(
          res0_dfm.smoothed_measurement_disturbance,
          res0_dfm_ar1.smoothed_state[1:],
      )
      assert_allclose(
          res0_dfm.smoothed_measurement_disturbance_cov,
          res0_dfm_ar1.smoothed_state_cov[1:, 1:, :],
      )
  
      # Note: it is difficult to test the EM algorithm for the idiosyncratic
      # variance terms, because actually the EM algorithm is slightly different
      # depending on whether idiosyncratic_ar1 is True or False.
      # - If idiosyncratic_ar1=False, then the variance term is computed
      #   conditional on the *updated estimate for the design matrix*, but the
      #   smoothed moments that were generated conditional on the *previous*
      #   estimate for the design matrix.
      # - If idiosyntratic_ar1=True, then the variance term is computed
      #   conditional on the *previous estimate for the design matrix* (this is
      #   because the estimated disturbance is part of the state vector, the
      #   estimates of which are not modified to account for the updated design
      #   matrix within this iteration)
      #
      # So instead, we'll just use a Monte Carlo-type test
  
      # Monte Carlo-type test, skipped by default
      if not SKIP_MONTE_CARLO_TESTS:
          # Test for MLE fitting: this is a Monte Carlo test, which requires a
          # quite large sample size; e.g., use nobs=50000 for atol=1e-1
          res_dfm = mod_dfm.fit()
          actual_dfm = res_dfm.params.copy()
          # normalize loadings and factor std dev.
          scalar = actual_dfm[0] / params_dfm[0]
          actual_dfm[11] *= scalar
          actual_dfm[:10] /= scalar
          assert_allclose(actual_dfm, params_dfm, atol=1e-1)
  
          res_dfm_ar1 = mod_dfm_ar1.fit()
          actual_dfm_ar1 = res_dfm_ar1.params.copy()
          # normalize loadings and factor std dev.
          scalar = actual_dfm_ar1[0] / params_dfm[0]
          actual_dfm_ar1[11] *= scalar
          actual_dfm_ar1[:10] /= scalar
          assert_allclose(actual_dfm_ar1, params_dfm_ar1, atol=1e-1)
  
          # Check the methods against each other
          desired = np.r_[actual_dfm_ar1[:12], actual_dfm_ar1[-10:]]
          assert_allclose(actual_dfm, desired, atol=1e-1)
  
imports: from statsmodels.compat.pandas import MONTH_END, QUARTER_END, assert_frame_equal, assert_series_equal
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_equal
  import pandas
  import pytest
  from statsmodels.regression.linear_model import OLS
  from statsmodels.tools import add_constant
  from statsmodels.tsa.statespace import dynamic_factor, dynamic_factor_mq, sarimax
  from statsmodels.tsa.statespace.tests import test_dynamic_factor_mq_monte_carlo
label_desc: Use image node_id 17 for calling a global function with example usage: test_idiosyncratic_ar1_False(reset_randomstate) without return types