# Path: src/pylogit/bootstrap_utils.py
# def check_conf_percentage_validity(conf_percentage):
#     """
#     Ensures that `conf_percentage` is in (0, 100). Raises a helpful ValueError
#     if otherwise.
#     """
#     msg = "conf_percentage MUST be a number between 0.0 and 100."
#     condition_1 = isinstance(conf_percentage, Number)
#     if not condition_1:
#         raise ValueError(msg)
#     else:
#         condition_2 = 0 < conf_percentage < 100
#         if not condition_2:
#             raise ValueError(msg)
#     return None
# 
# Path: src/pylogit/bootstrap_utils.py
# def ensure_samples_is_ndim_ndarray(samples, name='bootstrap', ndim=2):
#     """
#     Ensures that `samples` is an `ndim` numpy array. Raises a helpful
#     ValueError if otherwise.
#     """
#     assert isinstance(ndim, int)
#     assert isinstance(name, str)
#     if not isinstance(samples, np.ndarray) or not (samples.ndim == ndim):
#         sample_name = name + "_samples"
#         msg = "`{}` MUST be a {}D ndarray.".format(sample_name, ndim)
#         raise ValueError(msg)
#     return None
# 
# Path: src/pylogit/bootstrap_utils.py
# def get_alpha_from_conf_percentage(conf_percentage):
#     """
#     Calculates `100 - conf_percentage`, which is useful for calculating alpha
#     levels.
#     """
#     return 100.0 - conf_percentage
# 
# Path: src/pylogit/bootstrap_utils.py
# def combine_conf_endpoints(lower_array, upper_array):
#     """
#     Concatenates upper and lower endpoint arrays for a given confidence level.
#     """
#     return np.concatenate([lower_array[None, :], upper_array[None, :]], axis=0)


import numpy as np
from scipy.stats import norm
from .bootstrap_utils import check_conf_percentage_validity
from .bootstrap_utils import ensure_samples_is_ndim_ndarray
from .bootstrap_utils import get_alpha_from_conf_percentage
from .bootstrap_utils import combine_conf_endpoints
        being estimated.
    jackknife_replicates : 2D ndarray.
        Each row should correspond to a different jackknife parameter sample,
        formed by deleting a particular observation and then re-estimating the
        desired model. Each column should correspond to an element of the
        parameter vector being estimated.
    mle_params : 1D ndarray.
        The original dataset's maximum likelihood point estimate. Should have
        the same number of elements as `samples.shape[1]`.
    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 14.3.
    DiCiccio, Thomas J., and Bradley Efron. "Bootstrap confidence intervals."
        Statistical science (1996): 189-212.
    """
    # Check validity of arguments

# Path: src/pylogit/bootstrap_utils.py
# def check_conf_percentage_validity(conf_percentage):
#     """
#     Ensures that `conf_percentage` is in (0, 100). Raises a helpful ValueError
#     if otherwise.
#     """
#     msg = "conf_percentage MUST be a number between 0.0 and 100."
#     condition_1 = isinstance(conf_percentage, Number)
#     if not condition_1:
#         raise ValueError(msg)
#     else:
#         condition_2 = 0 < conf_percentage < 100
#         if not condition_2:
#             raise ValueError(msg)
#     return None
# 
# Path: src/pylogit/bootstrap_utils.py
# def ensure_samples_is_ndim_ndarray(samples, name='bootstrap', ndim=2):
#     """
#     Ensures that `samples` is an `ndim` numpy array. Raises a helpful
#     ValueError if otherwise.
#     """
#     assert isinstance(ndim, int)
#     assert isinstance(name, str)
#     if not isinstance(samples, np.ndarray) or not (samples.ndim == ndim):
#         sample_name = name + "_samples"
#         msg = "`{}` MUST be a {}D ndarray.".format(sample_name, ndim)
#         raise ValueError(msg)
#     return None
# 
# Path: src/pylogit/bootstrap_utils.py
# def get_alpha_from_conf_percentage(conf_percentage):
#     """
#     Calculates `100 - conf_percentage`, which is useful for calculating alpha
#     levels.
#     """
#     return 100.0 - conf_percentage
# 
# Path: src/pylogit/bootstrap_utils.py
# def combine_conf_endpoints(lower_array, upper_array):
#     """
#     Concatenates upper and lower endpoint arrays for a given confidence level.
#     """
#     return np.concatenate([lower_array[None, :], upper_array[None, :]], axis=0)


# Path: src/pylogit/bootstrap_calcs.py
import numpy as np
from scipy.stats import norm
from .bootstrap_utils import check_conf_percentage_validity
from .bootstrap_utils import ensure_samples_is_ndim_ndarray
from .bootstrap_utils import get_alpha_from_conf_percentage
from .bootstrap_utils import combine_conf_endpoints

        being estimated.
    jackknife_replicates : 2D ndarray.
        Each row should correspond to a different jackknife parameter sample,
        formed by deleting a particular observation and then re-estimating the
        desired model. Each column should correspond to an element of the
        parameter vector being estimated.
    mle_params : 1D ndarray.
        The original dataset's maximum likelihood point estimate. Should have
        the same number of elements as `samples.shape[1]`.
    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 14.3.
    DiCiccio, Thomas J., and Bradley Efron. "Bootstrap confidence intervals."
        Statistical science (1996): 189-212.
    """
    # Check validity of arguments

    check_conf_percentage_validity(conf_percentage)