code: def test_multistep(analytical_model_spec):
      # GH 670
      # Ensure all work as expected
      res = analytical_model_spec.fit(disp="off")
      fcasts = res.forecast(horizon=10)
      rv = fcasts.residual_variance
      assert np.all(np.isfinite(rv))
      assert rv.shape == (1, 10)
      fcasts_ri = res.forecast(horizon=10, reindex=True)
      rv_ri = fcasts_ri.residual_variance
      assert_frame_equal(rv, rv_ri.iloc[-1:])
      assert rv_ri.shape == (SP500.shape[0], 10)
  
imports: import datetime
  from itertools import product
  import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose
  import pandas
  from pandas.testing import assert_frame_equal
  import pytest
  from arch.data import sp500
  from arch.tests.univariate.test_variance_forecasting import preserved_state
  from arch.univariate import APARCH, ARX, EGARCH, FIGARCH, GARCH, HARCH, HARX, ConstantMean, ConstantVariance, EWMAVariance, MIDASHyperbolic, RiskMetrics2006, ZeroMean, arch_model
  from arch.univariate.mean import _ar_forecast, _ar_to_impulse
label_desc: Use image node_id 18 for calling a global function with example usage: test_multistep(analytical_model_spec) without return types