code: def test_emstep1(matlab_results, run):
      # Test that our EM step gets params2 from params1
      # Uses our default method for the observation equation, which is an
      # optimized version of the method presented in Bańbura and Modugno (2014)
      # (e.g. our version doesn't require the loop over T or the Kronecker
      # product)
      endog_M, endog_Q = matlab_results[:2]
      results1 = matlab_results[2][f"{run}1"]
      results2 = matlab_results[2][f"{run}2"]
  
      # Construct the model
      mod = dynamic_factor_mq.DynamicFactorMQ(
          endog_M.iloc[:, : results1["k_endog_M"]],
          endog_quarterly=endog_Q,
          factors=results1["factors"],
          factor_orders=results1["factor_orders"],
          factor_multiplicities=results1["factor_multiplicities"],
          idiosyncratic_ar1=True,
          init_t0=True,
          obs_cov_diag=True,
          standardize=True,
      )
  
      init = initialization.Initialization(
          mod.k_states,
          "known",
          constant=results1["initial_state"],
          stationary_cov=results1["initial_state_cov"],
      )
      res2, params2 = mod._em_iteration(
          results1["params"], init=init, mstep_method="missing"
      )
  
      # Test parameters
      true2 = results2["params"]
      assert_allclose(
          params2[mod._p["loadings"]], true2[mod._p["loadings"]]
      )
      assert_allclose(
          params2[mod._p["factor_ar"]], true2[mod._p["factor_ar"]]
      )
      assert_allclose(
          params2[mod._p["factor_cov"]], true2[mod._p["factor_cov"]]
      )
      assert_allclose(
          params2[mod._p["idiosyncratic_ar1"]],
          true2[mod._p["idiosyncratic_ar1"]],
      )
      assert_allclose(
          params2[mod._p["idiosyncratic_var"]],
          true2[mod._p["idiosyncratic_var"]],
      )
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_dynamic_factor_mq_frbny_nowcast.py
imports: from statsmodels.compat.pandas import QUARTER_END
  import os
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from scipy.io import matlab
  from statsmodels.tsa.statespace import dynamic_factor_mq, initialization
label_desc: Use image node_id 3 for calling a global function with example usage: test_emstep1(matlab_results, run) without return types