code: def test_news(matlab_results, run):
      endog_M, endog_Q = matlab_results[:2]
      results = matlab_results[2][run]
      updated_M, updated_Q = matlab_results[-2:]
  
      # Construct the base model
      mod1 = dynamic_factor_mq.DynamicFactorMQ(
          endog_M.iloc[:, : results["k_endog_M"]],
          endog_quarterly=endog_Q,
          factors=results["factors"],
          factor_orders=results["factor_orders"],
          factor_multiplicities=results["factor_multiplicities"],
          idiosyncratic_ar1=True,
          init_t0=True,
          obs_cov_diag=True,
          standardize=True,
      )
  
      mod1.initialize_known(
          results["initial_state"], results["initial_state_cov"]
      )
      res1 = mod1.smooth(results["params"], cov_type="none")
  
      # Construct the updated model
      res2 = res1.apply(
          updated_M.iloc[:, : results["k_endog_M"]],
          endog_quarterly=updated_Q,
          retain_standardization=True,
      )
  
      # Compute the news
      news = res2.news(
          res1, impact_date="2016-09", comparison_type="previous"
      )
  
      assert_allclose(
          news.revision_impacts.loc["2016-09", "GDPC1"],
          results["revision_impacts"],
      )
  
      columns = ["forecast (prev)", "observed", "weight", "impact"]
      actual = news.details_by_impact.loc["2016-09", "GDPC1"][columns]
      assert_allclose(
          actual.loc[("2016-06", "CPIAUCSL")], results["news_table"][0]
      )
      assert_allclose(
          actual.loc[("2016-06", "UNRATE")], results["news_table"][1]
      )
      assert_allclose(
          actual.loc[("2016-06", "PAYEMS")], results["news_table"][2]
      )
      if mod1.k_endog_M == 6:
          i = 6
          assert_allclose(
              actual.loc[("2016-06", "RSAFS")], results["news_table"][3]
          )
          assert_allclose(
              actual.loc[("2016-05", "TTLCONS")],
              results["news_table"][4],
          )
          assert_allclose(
              actual.loc[("2016-06", "TCU")], results["news_table"][5]
          )
      else:
          i = 3
      assert_allclose(
          actual.loc[("2016-06", "GDPC1")], results["news_table"][i]
      )
  
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 6 for calling a global function with example usage: test_news(matlab_results, run) without return types