code: def test_fc():
      if debug_mode:
          if "fc" not in to_test:
              return
          else:
              print("\n\nFORECAST", end="")
      for ds in datasets:
          for dt in dt_s_list:
              if debug_mode:
                  print("\n" + dt_s_tup_to_string(dt) + ": ", end="")
              steps = 5  # parsed JMulTi output comprises 5 steps
              last_observations = results_sm[ds][dt].endog[
                  -results_sm[ds][dt].k_ar :
              ]
              seasons = dt[1]
              if seasons == 0:
                  exog_future = None
              else:
                  exog_future = np.zeros((steps, seasons - 1))
                  # the following line is appropriate only if the last
                  # observation was in the next to last season (this is the case
                  # for macrodata)
                  exog_future[1:seasons] = np.identity(seasons - 1)
              err_msg = build_err_msg(ds, dt, "FORECAST")
              # test point forecast functionality of forecast method
              obtained = results_sm[ds][dt].forecast(
                  y=last_observations,
                  steps=steps,
                  exog_future=exog_future,
              )
              desired = results_ref[ds][dt]["fc"]["fc"]
              assert_allclose(
                  obtained, desired, rtol, atol, False, err_msg
              )
  
              # test forecast method with confidence interval calculation
              err_msg = build_err_msg(ds, dt, "FORECAST WITH INTERVALS")
              obtained = results_sm[ds][dt].forecast_interval(
                  y=last_observations,
                  steps=steps,
                  alpha=0.05,
                  exog_future=exog_future,
              )
              obt = obtained[0]  # forecast
              obt_l = obtained[1]  # lower bound
              obt_u = obtained[2]  # upper bound
              des = results_ref[ds][dt]["fc"]["fc"]
              des_l = results_ref[ds][dt]["fc"]["lower"]
              des_u = results_ref[ds][dt]["fc"]["upper"]
              assert_allclose(obt, des, rtol, atol, False, err_msg)
              assert_allclose(obt_l, des_l, rtol, atol, False, err_msg)
              assert_allclose(obt_u, des_u, rtol, atol, False, err_msg)
  
imports: import numpy
  from numpy.testing import assert_, assert_allclose, assert_raises
  import statsmodels.datasets.macrodata.data
  from statsmodels.tsa.vector_ar.tests.JMulTi_results.parse_jmulti_vecm_output import sublists
  from statsmodels.tsa.vector_ar.var_model import VAR
  from .JMulTi_results.parse_jmulti_var_output import dt_s_tup_to_string, load_results_jmulti
label_desc: Use image node_id 11 for calling a global function with example usage: test_fc() without return types