code: def check_results(
      res1, res2, check_lutkepohl=False, check_params=True
  ):
      # Check other results
      assert_allclose(res2.nobs, res1.nobs)
      assert_allclose(res2.nobs_diffuse, res1.nobs_diffuse)
      assert_allclose(res2.nobs_effective, res1.nobs_effective)
      assert_allclose(res2.k_diffuse_states, res1.k_diffuse_states)
  
      assert_allclose(res2.df_model, res1.df_model)
      assert_allclose(res2.df_resid, res1.df_resid)
  
      assert_allclose(res2.llf, res1.llf)
      assert_allclose(res2.aic, res1.aic)
      assert_allclose(res2.bic, res1.bic)
      assert_allclose(res2.hqic, res1.hqic)
  
      if check_lutkepohl:
          assert_allclose(
              res2.info_criteria("aic", "lutkepohl"),
              res1.info_criteria("aic", "lutkepohl"),
          )
          assert_allclose(
              res2.info_criteria("bic", "lutkepohl"),
              res1.info_criteria("bic", "lutkepohl"),
          )
          assert_allclose(
              res2.info_criteria("hqic", "lutkepohl"),
              res1.info_criteria("hqic", "lutkepohl"),
          )
  
      assert_allclose(res2.llf_obs, res1.llf_obs)
      assert_allclose(res2.fittedvalues, res1.fittedvalues)
      assert_allclose(res2.fittedvalues, res1.fittedvalues)
  
      if check_params:
          # Check parameter-related values
          mask_free = res2._free_params_index
          mask_fixed = res2._fixed_params_index
          pvalues = np.asarray(res2.pvalues)
          assert_allclose(pvalues[mask_free], res1.pvalues)
          assert_allclose(pvalues[mask_fixed], np.nan)
  
          bse = np.asarray(res2.bse)
          assert_allclose(bse[mask_free], res1.bse)
          assert_allclose(bse[mask_fixed], np.nan)
  
          zvalues = np.asarray(res2.zvalues)
          assert_allclose(zvalues[mask_free], res1.zvalues)
          assert_allclose(zvalues[mask_fixed], np.nan)
  
          # Check parameter covariance matrix
          mask_free = np.ix_(
              res2._free_params_index, res2._free_params_index
          )
          mask_fixed = np.ix_(
              res2._fixed_params_index, res2._fixed_params_index
          )
          assert_allclose(
              res2.cov_params_default.values[mask_free],
              res1.cov_params_default,
          )
          assert_allclose(
              res2.cov_params_default.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_approx.values[mask_free],
              res1.cov_params_approx,
          )
          assert_allclose(
              res2.cov_params_approx.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_oim.values[mask_free], res1.cov_params_oim
          )
          assert_allclose(
              res2.cov_params_oim.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_opg.values[mask_free], res1.cov_params_opg
          )
          assert_allclose(
              res2.cov_params_opg.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_robust.values[mask_free],
              res1.cov_params_robust,
          )
          assert_allclose(
              res2.cov_params_robust.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_robust_oim.values[mask_free],
              res1.cov_params_robust_oim,
          )
          assert_allclose(
              res2.cov_params_robust_oim.values[mask_fixed], np.nan
          )
  
          assert_allclose(
              res2.cov_params_robust_approx.values[mask_free],
              res1.cov_params_robust_approx,
          )
          assert_allclose(
              res2.cov_params_robust_approx.values[mask_fixed], np.nan
          )
  
      # Check residual hypothesis tests
      assert_allclose(
          res2.test_normality("jarquebera"),
          res1.test_normality("jarquebera"),
      )
  
      assert_allclose(
          res2.test_heteroskedasticity("breakvar"),
          res1.test_heteroskedasticity("breakvar"),
      )
  
      actual = res2.test_serial_correlation("ljungbox")
      desired = res1.test_serial_correlation("ljungbox")
      assert_allclose(actual, desired)
  
imports: import numpy
  import pytest
  from statsmodels import datasets
  from statsmodels.tsa.statespace import initialization, mlemodel, sarimax, structural, dynamic_factor, varmax
  from numpy.testing import assert_, assert_raises, assert_equal, assert_allclose
label_desc: Use image node_id 11 for calling a global function with example usage: check_results(res1, res2, check_lutkepohl, check_params) without return types