code: def test_max_method(self):
      def max_step(losses, indices):
          # A basic but direct implementation of the max method
          k = losses.shape[1]
          b = len(indices)
          loss_errors = losses - losses.mean(0)
          stats = np.zeros((b, k))
          for n in range(b):
              # Compute bootstrapped versions
              bs_loss_errors = loss_errors[indices[n]]
              stats[n] = bs_loss_errors.mean(0) - bs_loss_errors.mean()
          variances = (stats**2).mean(0)
          std_devs = np.sqrt(variances)
          stat_dist = np.max(stats / std_devs, 1)
  
          test_stat = losses.mean(0) - losses.mean()
          std_test_stat = test_stat / std_devs
          test_stat = np.max(std_test_stat)
          pval = (test_stat < stat_dist).mean()
          drop_index = np.argwhere(std_test_stat == test_stat).squeeze()
          return pval, drop_index, std_devs
  
      losses = self.losses[:, :10]  # Limit size
      mcs = MCS(losses, 0.05, reps=200, method="max", seed=23456)
      mcs.compute()
      m = 8  # Number of direct
      pvals = np.zeros(m) * np.nan
      indices = np.zeros(m) * np.nan
      for i in range(m):
          removed = list(indices[np.isfinite(indices)])
          include = list(set(list(range(10))).difference(removed))
          include.sort()
          pval, drop_index, _ = max_step(
              losses[:, np.array(include)], mcs._bootstrap_indices
          )
          pvals[i] = pval if i == 0 else np.max([pvals[i - 1], pval])
          indices[i] = include[drop_index]
      direct = pd.DataFrame(
          pvals,
          index=np.array(indices, dtype=np.int64),
          columns=["Pvalue"],
      )
      direct.index.name = "Model index"
      assert_frame_equal(mcs.pvalues.iloc[:m], direct)
  
imports: from typing import NamedTuple
  import numpy
  from numpy import linspace
  from numpy.random import RandomState
  from numpy.testing import assert_allclose, assert_equal
  import pandas
  from pandas.testing import assert_frame_equal, assert_series_equal
  import pytest
  import scipy.stats
  from arch.bootstrap import CircularBlockBootstrap, MovingBlockBootstrap, StationaryBootstrap
  from arch.bootstrap.multiple_comparison import MCS, SPA, StepM
label_desc: Use image node_id 3 for calling the TestMCS obj's underlying member method code with example usage: obj.test_max_method() and returns: pval,  drop_index,  std_devs