class_docstr: Test of Superior Predictive Ability (SPA) of White and Hansen.
  
  The SPA is also known as the Reality Check or Bootstrap Data Snooper.
  
  Parameters
  ----------
  benchmark : {ndarray, Series}
      T element array of benchmark model *losses*
  models : {ndarray, DataFrame}
      T  by k element array of alternative model *losses*
  block_size : int, optional
      Length of window to use in the bootstrap.  If not provided, sqrt(T)
      is used.  In general, this should be provided and chosen to be
      appropriate for the data.
  reps : int, optional
      Number of bootstrap replications to uses.  Default is 1000.
  bootstrap : str, optional
      Bootstrap to use.  Options are
      'stationary' or 'sb': Stationary bootstrap (Default)
      'circular' or 'cbb': Circular block bootstrap
      'moving block' or 'mbb': Moving block bootstrap
  studentize : bool
      Flag indicating to studentize loss differentials. Default is True
  nested : bool
      Flag indicating to use a nested bootstrap to compute variances for
      studentization.  Default is False.  Note that this can be slow since
      the procedure requires k extra bootstraps.
  seed : {int, Generator, RandomState}, optional
      Seed value to use when creating the bootstrap used in the comparison.
      If an integer or None, the NumPy default_rng is used with the seed
      value.  If a Generator or a RandomState, the argument is used.
  
  Notes
  -----
  The three p-value correspond to different re-centering decisions.
      - Upper : Never recenter to all models are relevant to distribution
      - Consistent : Only recenter if closer than a log(log(t)) bound
      - Lower : Never recenter a model if worse than benchmark
  
  See [1]_ and [2]_ for details.
  
  See Also
  --------
  StepM
  
  References
  ----------
  .. [1] Hansen, P. R. (2005). A test for superior predictive ability.
     Journal of Business & Economic Statistics, 23(4), 365-380.
  .. [2] White, H. (2000). A reality check for data snooping. Econometrica,
     68(5), 1097-1126.
class_docstr_tok: ["Test","of","Superior","Predictive","Ability","(","SPA",")","of","White","and","Hansen",".","The","SPA","is","also","known","as","the","Reality","Check","or","Bootstrap","Data","Snooper",".","Parameters","--","--","--","--","--","benchmark",":","{","ndarray",",","Series","}","T","element","array","of","benchmark","model","*","losses","*","models",":","{","ndarray",",","DataFrame","}","T","by","k","element","array","of","alternative","model","*","losses","*","block_size",":","int",",","optional","Length","of","window","to","use","in","the","bootstrap",".","If","not","provided",",","sqrt","(","T",")","is","used",".","In","general",",","this","should","be","provided","and","chosen","to","be","appropriate","for","the","data",".","reps",":","int",",","optional","Number","of","bootstrap","replications","to","uses",".","Default","is","1000.","bootstrap",":","str",",","optional","Bootstrap","to","use",".","Options","are","'stationary","'","or","'sb","'",":","Stationary","bootstrap","(","Default",")","'circular","'","or","'cbb","'",":","Circular","block","bootstrap","'moving","block","'","or","'mbb","'",":","Moving","block","bootstrap","studentize",":","bool","Flag","indicating","to","studentize","loss","differentials",".","Default","is","True","nested",":","bool","Flag","indicating","to","use","a","nested","bootstrap","to","compute","variances","for","studentization",".","Default","is","False",".","Note","that","this","can","be","slow","since","the","procedure","requires","k","extra","bootstraps",".","seed",":","{","int",",","Generator",",","RandomState","}",",","optional","Seed","value","to","use","when","creating","the","bootstrap","used","in","the","comparison",".","If","an","integer","or","None",",","the","NumPy","default_rng","is","used","with","the","seed","value",".","If","a","Generator","or","a","RandomState",",","the","argument","is","used",".","Notes","--","--","-","The","three","p-value","correspond","to","different","re-centering","decisions",".","-","Upper",":","Never","recenter","to","all","models","are","relevant","to","distribution","-","Consistent",":","Only","recenter","if","closer","than","a","log","(","log","(","t",")",")","bound","-","Lower",":","Never","recenter","a","model","if","worse","than","benchmark","See","[","1","]","_","and","[","2","]","_","for","details",".","See","Also","--","--","--","--","StepM","References","--","--","--","--","--","..","[","1","]","Hansen",",","P.","R.","(","2005",")",".","A","test","for","superior","predictive","ability",".","Journal","of","Business","&","Economic","Statistics",",","23","(","4",")",",","365-380",".","..","[","2","]","White",",","H.","(","2000",")",".","A","reality","check","for","data","snooping",".","Econometrica",",","68","(","5",")",",","1097-1126","."]
code: def _simulate_values(self) -> None:
      self._compute_variance()
      # 2. Compute invalid columns using criteria for consistent
      self._valid_columns = self._check_column_validity()
      # 3. Compute simulated values
      # Upper always re-centers
      upper_mean = self._loss_diff.mean(0)
      consistent_mean = upper_mean.copy()
      consistent_mean[np.logical_not(self._valid_columns)] = 0.0
      lower_mean = upper_mean.copy()
      # Lower does not re-center those that are worse
      lower_mean[lower_mean < 0] = 0.0
      means = [lower_mean, consistent_mean, upper_mean]
      simulated_vals = np.zeros((self.k, self.reps, 3))
      for i, bs_data in enumerate(self.bootstrap.bootstrap(self.reps)):
          pos_arg, kw_arg = bs_data
          loss_diff_star = pos_arg[0]
          for j, mean in enumerate(means):
              simulated_vals[:, i, j] = loss_diff_star.mean(0) - mean
      self._simulated_vals = simulated_vals
  
imports: from __future__ import annotations
  from collections.abc import Hashable, Sequence
  import copy
  from typing import cast
  import warnings
  import numpy
  import pandas
  from arch.bootstrap.base import CircularBlockBootstrap, MovingBlockBootstrap, StationaryBootstrap
  from arch.typing import ArrayLike, ArrayLike2D, BoolArray, Float64Array, Int64Array, IntArray, Literal, Uint32Array
  from arch.utility.array import DocStringInheritor, ensure2d
label_desc: Use image node_id 5 for calling the SPA obj's underlying member method code with example usage: obj._simulate_values() without return types