arch.bootstrap.IndependentSamplesBootstrap.apply

IndependentSamplesBootstrap.apply(func: Callable[[...], ndarray | DataFrame | Series], reps: int = 1000, extra_kwargs: dict[str, Any] | None = None) ndarray[Any, dtype[float64]]

Applies a function to bootstrap replicated data

Parameters:
func: Callable[[...], ndarray | DataFrame | Series]

Function the computes parameter values. See Notes for requirements

reps: int = 1000

Number of bootstrap replications

extra_kwargs: dict[str, Any] | None = 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:

numpy.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)