code: def check_irf(test, mod, results, params=None):
      # Note that 'vars' uses an estimator of Sigma_u with k_params fewer degrees
      # of freedom to compute impulse responses, so we need to reset the
      # state_cov matrix for this part of the test
      Sigma_u_mle = mod["state_cov"]
      nobs_effective = mod.nobs - mod.k_ar
      df_resid = nobs_effective - (
          mod.k_ar * mod.k_endog + mod.k_trend + mod.k_exog
      )
      Sigma_u = Sigma_u_mle * nobs_effective / df_resid
  
      L = np.linalg.cholesky(Sigma_u)
      if params is None:
          params = np.copy(results["params"])
      params[-6:] = L[np.tril_indices_from(L)]
      res = mod.smooth(params)
  
      for i in range(3):
          impulse_to = endog.columns[i]
  
          # Non-orthogonalized
          columns = [
              "{}.irf.{}.{}".format(test, impulse_to, name)
              for name in endog.columns
          ]
          assert_allclose(
              res.impulse_responses(10, i),
              results_var_R_output[columns],
          )
  
          # Orthogonalized
          columns = [
              "{}.irf.ortho.{}.{}".format(test, impulse_to, name)
              for name in endog.columns
          ]
          assert_allclose(
              res.impulse_responses(10, i, orthogonalized=True),
              results_var_R_output[columns],
          )
  
          # Orthogonalized, cumulated
          columns = [
              "{}.irf.cumu.{}.{}".format(test, impulse_to, name)
              for name in endog.columns
          ]
          result = res.impulse_responses(
              10, i, orthogonalized=True, cumulative=True
          )
          assert_allclose(result, results_var_R_output[columns])
  
file_path: statsmodels/statsmodels/tsa/statespace/tests/test_var.py
imports: import os
  import numpy
  from numpy.testing import assert_allclose
  import pandas
  from statsmodels.tsa.statespace import varmax
  from .results import results_var_R
label_desc: Use image node_id 1 for calling a global function with example usage: check_irf(test, mod, results, params) without return types