arch.bootstrap.CircularBlockBootstrap.conf_int

CircularBlockBootstrap.conf_int(func, reps=1000, method='basic', size=0.95, tail='two', extra_kwargs=None, reuse=False, sampling='nonparametric', std_err_func=None, studentize_reps=1000)
Parameters
  • func (callable) – Function the computes parameter values. See Notes for requirements

  • reps (int, default 1000) – Number of bootstrap replications

  • method (string, default "basic") – One of ‘basic’, ‘percentile’, ‘studentized’, ‘norm’ (identical to ‘var’, ‘cov’), ‘bc’ (identical to ‘debiased’, ‘bias-corrected’), or ‘bca’

  • size (float, default 0.95) – Coverage of confidence interval

  • tail (string, default "two") – One of ‘two’, ‘upper’ or ‘lower’.

  • reuse (bool, default 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 (string, default "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, default None) – Extra keyword arguments to use when calling func and std_err_func, when appropriate

  • std_err_func (callable, default 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, default 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

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