arch.bootstrap.IndependentSamplesBootstrap.conf_int

IndependentSamplesBootstrap.conf_int(func: Callable[[...], ndarray], reps: int = 1000, method: 'basic' | 'percentile' | 'studentized' | 'norm' | 'bc' | 'bca' = 'basic', size: float = 0.95, tail: 'two' | 'upper' | 'lower' = 'two', extra_kwargs: dict[str, Any] | None = None, reuse: bool = False, sampling: 'nonparametric' | 'semi-parametric' | 'semi' | 'parametric' | 'semiparametric' = 'nonparametric', std_err_func: Callable[[...], ndarray | DataFrame | Series] | None = None, studentize_reps: int = 1000) ndarray
Parameters:
func: Callable[[...], ndarray]

Function the computes parameter values. See Notes for requirements

reps: int = 1000

Number of bootstrap replications

method: 'basic' | 'percentile' | 'studentized' | 'norm' | 'bc' | 'bca' = 'basic'

One of ‘basic’, ‘percentile’, ‘studentized’, ‘norm’ (identical to ‘var’, ‘cov’), ‘bc’ (identical to ‘debiased’, ‘bias-corrected’), or ‘bca’

size: float = 0.95

Coverage of confidence interval

tail: 'two' | 'upper' | 'lower' = 'two'

One of ‘two’, ‘upper’ or ‘lower’.

reuse: bool = False

Flag indicating whether to reuse previously computed bootstrap results. This allows alternative methods to be compared without rerunning the bootstrap simulation. Reuse is ignored if reps is not the same across multiple runs, func changes across calls, or method is ‘studentized’.

sampling: 'nonparametric' | 'semi-parametric' | 'semi' | 'parametric' | 'semiparametric' = 'nonparametric'

Type of sampling to use: ‘nonparametric’, ‘semi-parametric’ (or ‘semi’) or ‘parametric’. The default is ‘nonparametric’. See notes about the changes to func required when using ‘semi’ or ‘parametric’.

extra_kwargs: dict[str, Any] | None = None

Extra keyword arguments to use when calling func and std_err_func, when appropriate

std_err_func: Callable[[...], ndarray | DataFrame | Series] | None = None

Function to use when standardizing estimated parameters when using the studentized bootstrap. Providing an analytical function eliminates the need for a nested bootstrap

studentize_reps: int = 1000

Number of bootstraps to use in the inner bootstrap when using the studentized bootstrap. Ignored when std_err_func is provided

Returns:

Computed confidence interval. Row 0 contains the lower bounds, and row 1 contains the upper bounds. Each column corresponds to a parameter. When tail is ‘lower’, all upper bounds are inf. Similarly, ‘upper’ sets all lower bounds to -inf.

Return type:

numpy.ndarray

Examples

>>> import numpy as np
>>> def func(x):
...     return x.mean(0)
>>> y = np.random.randn(1000, 2)
>>> from arch.bootstrap import IIDBootstrap
>>> bs = IIDBootstrap(y)
>>> ci = bs.conf_int(func, 1000)

Notes

When there are no extra keyword arguments, the function is called

func(*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.

The standard error function, if provided, must return a vector of parameter standard errors and is called

std_err_func(params, *args, **kwargs)

where params is the vector of estimated parameters using the same bootstrap data as in args and kwargs.

The bootstraps are:

  • ‘basic’ - Basic confidence using the estimated parameter and difference between the estimated parameter and the bootstrap parameters

  • ‘percentile’ - Direct use of bootstrap percentiles

  • ‘norm’ - Makes use of normal approximation and bootstrap covariance estimator

  • ‘studentized’ - Uses either a standard error function or a nested bootstrap to estimate percentiles and the bootstrap covariance for scale

  • ‘bc’ - Bias corrected using estimate bootstrap bias correction

  • ‘bca’ - Bias corrected and accelerated, adding acceleration parameter to ‘bc’ method