code: def test_grouped_revisions(revisions_details_start):
      # Tests for computing revision impacts when all revisions are grouped
      # together (i.e. no detailed impacts are computed )
      # Construct original and revised datasets
      y = (
          np.log(dta[["realgdp", "realcons", "realinv", "cpi"]])
          .diff()
          .iloc[1:]
          * 100
      )
      y.iloc[-1, 0] = np.nan
  
      y_revised = y.copy()
      revisions = {
          ("2009Q2", "realgdp"): 1.1,
          ("2009Q3", "realcons"): 0.5,
          ("2009Q2", "realinv"): -0.3,
          ("2009Q2", "cpi"): 0.2,
          ("2009Q3", "cpi"): 0.2,
      }
      for key, diff in revisions.items():
          y_revised.loc[key] += diff
  
      # Create model and results
      mod = varmax.VARMAX(y, trend="n")
      ar_coeff = {
          "realgdp": 0.9,
          "realcons": 0.8,
          "realinv": 0.7,
          "cpi": 0.6,
      }
      params = np.r_[
          np.diag(list(ar_coeff.values())).flatten(),
          [1, 0, 1, 0, 0, 1, 0, 0, 0, 1],
      ]
      res = mod.smooth(params)
      res_revised = res.apply(y_revised)
      news = res_revised.news(
          res,
          comparison_type="previous",
          tolerance=-1,
          revisions_details_start=revisions_details_start,
      )
  
      # Tests
      data_revisions = news.data_revisions
      revision_details = news.revision_details_by_update.reset_index(
          [2, 3]
      )
  
      for key, diff in revisions.items():
          assert_allclose(
              data_revisions.loc[key, "revised"], y_revised.loc[key]
          )
          assert_allclose(
              data_revisions.loc[key, "observed (prev)"], y.loc[key]
          )
          assert_equal(
              # Need to manually cast to numpy for compatibility with
              # pandas==1.2.5
              np.array(
                  data_revisions.loc[key, "detailed impacts computed"]
              ),
              False,
          )
  
      # For grouped data, should not have any of revised, observed (prev),
      # revision, weight
      key = ("2009Q3", "all prior revisions", "2009Q3")
      cols = ["revised", "observed (prev)", "revision", "weight"]
      assert np.all(revision_details.loc[key, cols].isnull())
  
      # Expected grouped impacts are the sum of the detailed impacts from
      # `test_detailed_revisions`
      assert_allclose(
          revision_details.loc[key + ("realgdp",), "impact"],
          ar_coeff["realgdp"] * revisions[("2009Q2", "realgdp")],
      )
      assert_allclose(
          revision_details.loc[key + ("realcons",), "impact"],
          revisions[("2009Q3", "realcons")],
      )
      assert_allclose(
          revision_details.loc[key + ("realinv",), "impact"], 0
      )
      assert_allclose(
          revision_details.loc[key + ("cpi",), "impact"],
          revisions[("2009Q3", "cpi")],
      )
  
      # Check the values for estimates
      for name in ["cpi", "realcons", "realinv"]:
          assert_allclose(
              news.impacts.loc[("2009Q3", name), "estimate (new)"],
              y_revised.loc["2009Q3", name],
          )
          assert_allclose(
              news.impacts.loc[("2009Q3", name), "estimate (prev)"],
              y.loc["2009Q3", name],
          )
      # Have to handle real GDP separately since the 2009Q3 value is missing
      name = "realgdp"
      assert_allclose(
          news.impacts.loc[("2009Q3", name), "estimate (new)"],
          y_revised.loc["2009Q2", name] * ar_coeff[name],
      )
      assert_allclose(
          news.impacts.loc[("2009Q3", name), "estimate (prev)"],
          y.loc["2009Q2", name] * ar_coeff[name],
      )
  
      # Check that the values of revision impacts sum up correctly
      assert_allclose(
          news.impacts["impact of revisions"],
          revision_details.groupby(level=[2, 3]).sum()["impact"],
      )
  
imports: from statsmodels.compat.pandas import FUTURE_STACK, assert_frame_equal, assert_series_equal
  import numpy
  from numpy.testing import assert_, assert_allclose, assert_equal
  import pandas
  import pytest
  from statsmodels import datasets
  from statsmodels.tsa.statespace import dynamic_factor, sarimax, structural, varmax
label_desc: Use image node_id 18 for calling a global function with example usage: test_grouped_revisions(revisions_details_start) without return types