arch.bootstrap.StationaryBootstrap.apply¶
-
StationaryBootstrap.
apply
(func, reps=1000, extra_kwargs=None)¶ Applies a function to bootstrap replicated data
- Parameters
func (callable) -- Function the computes parameter values. See Notes for requirements
reps (int, default 1000) -- Number of bootstrap replications
extra_kwargs (dict, default None) -- Extra keyword arguments to use when calling func. Must not conflict with keyword arguments used to initialize bootstrap
- Returns
reps by nparam array of computed function values where each row corresponds to a bootstrap iteration
- Return type
ndarray
Notes
When there are no extra keyword arguments, the function is called
func(params, *args, **kwargs)
where args and kwargs are the bootstrap version of the data provided when setting up the bootstrap. When extra keyword arguments are used, these are appended to kwargs before calling func
Examples
>>> import numpy as np >>> x = np.random.randn(1000,2) >>> from arch.bootstrap import IIDBootstrap >>> bs = IIDBootstrap(x) >>> def func(y): ... return y.mean(0) >>> results = bs.apply(func, 100)