def calc_percentile_interval(bootstrap_replicates, conf_percentage):
    """
    Calculate bootstrap confidence intervals based on raw percentiles of the
    bootstrap distribution of samples.

    Parameters
    ----------
    bootstrap_replicates : 2D ndarray.
        Each row should correspond to a different bootstrap parameter sample.
        Each column should correspond to an element of the parameter vector
        being estimated.
    conf_percentage : scalar in the interval (0.0, 100.0).
        Denotes the confidence-level of the returned confidence interval. For
        instance, to calculate a 95% confidence interval, pass `95`.

    Returns
    -------
    conf_intervals : 2D ndarray.
        The shape of the returned array will be `(2, samples.shape[1])`. The
        first row will correspond to the lower value in the confidence
        interval. The second row will correspond to the upper value in the
        confidence interval. There will be one column for each element of the
        parameter vector being estimated.

    References
    ----------
    Efron, Bradley, and Robert J. Tibshirani. An Introduction to the Bootstrap.
        CRC press, 1994. Section 12.5 and Section 13.3. See Equation 13.3.

    Notes
    -----
    This function differs slightly from the actual percentile bootstrap
    procedure described in Efron and Tibshirani (1994). To ensure that the
    returned endpoints of one's bootstrap confidence intervals are actual
    values that were observed in the bootstrap distribution, both the procedure
    of Efron and Tibshirani and this function make more conservative confidence
    intervals. However, this function uses a simpler (and in some cases less
    conservative) correction than that of Efron and Tibshirani.
    """
    # Check validity of arguments
    check_conf_percentage_validity(conf_percentage)
    ensure_samples_is_ndim_ndarray(bootstrap_replicates, ndim=2)
    # Get the alpha * 100% value
    alpha = get_alpha_from_conf_percentage(conf_percentage)
    # Get the lower and upper percentiles that demarcate the desired interval.
    lower_percent = alpha / 2.0
    upper_percent = 100.0 - lower_percent
    # Calculate the lower and upper endpoints of the confidence intervals.
    # Note that the particular choices of interpolation methods are made in
    # order to produce conservatively wide confidence intervals and ensure that
    # all returned endpoints in the confidence intervals are actually observed
    # in the bootstrap distribution. This is in accordance with the spirit of
    # Efron and Tibshirani (1994).
    lower_endpoint = np.percentile(bootstrap_replicates,
                                   lower_percent,
                                   interpolation='lower',
                                   axis=0)
    upper_endpoint = np.percentile(bootstrap_replicates,
                                   upper_percent,
                                   interpolation='higher',
                                   axis=0)
    # Combine the enpoints into a single ndarray.
    conf_intervals = combine_conf_endpoints(lower_endpoint, upper_endpoint)
    return conf_intervals
Calculate bootstrap confidence intervals based on raw percentiles of the
    bootstrap distribution of samples.

    Parameters
    ----------
    bootstrap_replicates : 2D ndarray.
        Each row should correspond to a different bootstrap parameter sample.
        Each column should correspond to an element of the parameter vector
        being estimated.
    conf_percentage : scalar in the interval (0.0, 100.0).
        Denotes the confidence-level of the returned confidence interval. For
        instance, to calculate a 95% confidence interval, pass `95`.

    Returns
    -------
    conf_intervals : 2D ndarray.
        The shape of the returned array will be `(2, samples.shape[1])`. The
        first row will correspond to the lower value in the confidence
        interval. The second row will correspond to the upper value in the
        confidence interval. There will be one column for each element of the
        parameter vector being estimated.

    References
    ----------
    Efron, Bradley, and Robert J. Tibshirani. An Introduction to the Bootstrap.
        CRC press, 1994. Section 12.5 and Section 13.3. See Equation 13.3.

    Notes
    -----
    This function differs slightly from the actual percentile bootstrap
    procedure described in Efron and Tibshirani (1994). To ensure that the
    returned endpoints of one's bootstrap confidence intervals are actual
    values that were observed in the bootstrap distribution, both the procedure
    of Efron and Tibshirani and this function make more conservative confidence
    intervals. However, this function uses a simpler (and in some cases less
    conservative) correction than that of Efron and Tibshirani.