code: def test_append_extend_apply(reset_randomstate):
      # Most of `append`, `extend`, and `apply` are tested in
      # `test_standardized_{monthly,MQ}`, but here we test a couple of minor
      # things
      endog, loadings, phi, sigma2, _, idio_var = gen_dfm_data(
          k_endog=10, nobs=100
      )
      endog1 = endog.iloc[:-10]
      endog2 = endog.iloc[-10:]
      mod = dynamic_factor_mq.DynamicFactorMQ(
          endog1,
          factor_orders=1,
          standardize=False,
          idiosyncratic_ar1=False,
      )
      params = np.r_[loadings, phi, sigma2, idio_var]
      res = mod.smooth(params)
  
      # Test that error is raised if we try to extend the sample with a dataset
      # of a different dimension
      msg = "Cannot append data of a different dimension to a model."
      with pytest.raises(ValueError, match=msg):
          res.append(endog2.iloc[:, :3])
      with pytest.raises(ValueError, match=msg):
          res.extend(endog2.iloc[:, :3])
  
      # Test that copy_initialization works
      mod.initialize_known([0.1], [[1.0]])
      res2 = mod.smooth(params)
      # These asserts just show that the initialization really is different
      assert_allclose(res.filter_results.initial_state, 0)
      assert_allclose(res.filter_results.initial_state_cov, 4 / 3.0)
      assert_allclose(res2.filter_results.initial_state, 0.1)
      assert_allclose(res2.filter_results.initial_state_cov, 1.0)
  
      # Check append
      res3 = res2.append(endog2, copy_initialization=False)
      assert_allclose(res3.filter_results.initial_state, 0)
      assert_allclose(res3.filter_results.initial_state_cov, 4 / 3.0)
  
      res4 = res2.append(endog2, copy_initialization=True)
      assert_allclose(res4.filter_results.initial_state, 0.1)
      assert_allclose(res4.filter_results.initial_state_cov, 1.0)
  
      # Check apply
      res5 = res2.apply(endog, copy_initialization=False)
      assert_allclose(res5.filter_results.initial_state, 0)
      assert_allclose(res5.filter_results.initial_state_cov, 4 / 3.0)
  
      res6 = res2.apply(endog, copy_initialization=True)
      assert_allclose(res6.filter_results.initial_state, 0.1)
      assert_allclose(res6.filter_results.initial_state_cov, 1.0)
  
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 13 for calling a global function with example usage: test_append_extend_apply(reset_randomstate) without return types