bebi103.bootstrap.draw_bs_reps_mle

bebi103.bootstrap.draw_bs_reps_mle(mle_fun, gen_fun, data, mle_args=(), gen_args=(), size=1, n_jobs=1, progress_bar=False, rng=None)

Draw bootstrap replicates of maximum likelihood estimator.

Parameters
  • mle_fun (function) – Function with call signature mle_fun(data, *mle_args) that computes a MLE for the parameters.

  • gen_fun (function) – Function to randomly draw a new data set out of the model distribution parametrized by the MLE. Must have call signature gen_fun(params, *gen_args, size, rng). Note that size as an argument in this function relates to the number of data you will generate, which is always equal to len(data). This is not the same as the size argument of draw_bs_reps_mle(), which is the number of bootstrap replicates you wish to draw.

  • data (Numpy array, possibly multidimensional) – Array of measurements. The first index should index repeat of experiment. E.g., if the data consist of n (x, y) pairs, data should have shape (n, 2).

  • mle_args (tuple, default ()) – Arguments to be passed to mle_fun().

  • gen_args (tuple, default ()) – Arguments to be passed to gen_fun().

  • size (int, default 1) – Number of bootstrap replicates to draw.

  • n_jobs (int, default 1) – Number of cores to use in drawing bootstrap replicates.

  • progress_bar (bool, default False) – Whether or not to display progress bar.

  • rng (numpy.random.Generator instance, default None) – RNG to be used in bootstrapping. If None, the default Numpy RNG is used with a fresh seed based on the clock.

Returns

output – Bootstrap replicates of MLEs.

Return type

numpy array