arch.bootstrap.SPA

class arch.bootstrap.SPA(benchmark: ndarray | DataFrame | Series, models: ndarray | DataFrame | Series, block_size: int | None = None, reps: int = 1000, bootstrap: 'stationary' | 'sb' | 'circular' | 'cbb' | 'moving block' | 'mbb' = 'stationary', studentize: bool = True, nested: bool = False, *, seed: int | Generator | RandomState | None = None)[source]

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 | DataFrame | Series

T element array of benchmark model losses

models: ndarray | DataFrame | Series

T by k element array of alternative model losses

block_size: int | None = None

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 = 1000

Number of bootstrap replications to uses. Default is 1000.

bootstrap: 'stationary' | 'sb' | 'circular' | 'cbb' | 'moving block' | 'mbb' = 'stationary'

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 = True

Flag indicating to studentize loss differentials. Default is True

nested: bool = False

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 | None = None

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

Methods

better_models([pvalue, pvalue_type])

Returns set of models rejected as being equal-or-worse than the benchmark

compute()

Compute the bootstrap pvalue.

critical_values([pvalue])

Returns data-dependent critical values

reset()

Reset the bootstrap to its initial state.

seed(value)

Seed the bootstrap's random number generator

subset(selector)

Sets a list of active models to run the SPA on.

Properties

pvalues

P-values corresponding to the lower, consistent and upper p-values.