Chapter XIV

Sampling

โฆ โฆ โฆ

The Source

ยง I bootstrap

# X : population; k : sample size
def bootstrap(X, k):
    return choices(X, k=k)  # "choices" for sampling with replacement

ยง II repeat_bootstrap

# repeat bootstrap sampling n times
def repeat_bootstrap(X, k, n):
    reps = []
    for _ in range(n):
        reps.append(bootstrap(X, k=k))
    return reps