-
Notifications
You must be signed in to change notification settings - Fork 376
Open
Description
The bootstrap results are not reproducible, even though I set the random seed np.random.seed(17) at the beginning of the program.
However, if I add np.random.seed(11) to this function, it works and is reproducible.
==================================================================
@njit
def bca_boot_conf(
x: NDArray[np.float64],
n: int,
n_boot: int,
fn: Callable[[NDArray[np.float64]], float],
) -> BootConfIntervals:
"""Computes confidence intervals for a user-defined parameter using the
bias corrected and accelerated (BCa) bootstrap method. <https://blogs.sas.com/content/iml/2017/07/12/bootstrap-bca-interval.html>_
Args:
x: :class:`numpy.ndarray` containing the data for the randomized
bootstrap sampling.
n: Number of elements in each random bootstrap sample.
n_boot: Number of random bootstrap samples to use.
fn: :class:`Callable` for computing the parameter used for the
confidence intervals.
Returns:
:class:`.BootConfIntervals` containing the computed confidence
intervals.
"""
np.random.seed(17)
if n <= 0:
raise ValueError("Bootstrap sample size must be greater than 0.")
if n_boot <= 0:
raise ValueError("Number of boostrap samples must be greater than 0.")
n_x = len(x)
Metadata
Metadata
Assignees
Labels
No labels