src/estimagic/inference/bootstrap_ci.py
def _ci_t(data, outcome, estimates, alpha, n_cores):
    """Compute studentized confidence interval of bootstrap estimates.

    Args:
        data (pd.DataFrame): original dataset.
        outcome (callable): function of the data calculating statistic of interest.
        estimates (data.Frame): DataFrame of estimates in the bootstrap samples.
        alpha (float): significance level of choice.
        n_cores (int): number of jobs for parallelization.

    Returns:
        cis (np.array): array where k'th row contains CI for k'th parameter.

    """

    num_params = estimates.shape[1]
    boot_est = estimates.values
    cis = np.zeros((num_params, 2))
    theta = outcome(data)

    for k in range(num_params):

        params = boot_est[:, k]

        theta_std = np.std(params)

        tq = _eqf((params - theta[k]) / theta_std)
        t1 = tq(1 - alpha / 2)
        t2 = tq(alpha / 2)

        cis[k, :] = np.array([theta[k] - theta_std * t1, theta[k] - theta_std * t2])

    return cis
Compute studentized confidence interval of bootstrap estimates.

    Args:
        data (pd.DataFrame): original dataset.
        outcome (callable): function of the data calculating statistic of interest.
        estimates (data.Frame): DataFrame of estimates in the bootstrap samples.
        alpha (float): significance level of choice.
        n_cores (int): number of jobs for parallelization.

    Returns:
        cis (np.array): array where k'th row contains CI for k'th parameter.

    
Compute studentized confidence interval of bootstrap estimates.
Compute studentized confidence interval of bootstrap estimates .
def _ci_t(data, outcome, estimates, alpha, n_cores):
    num_params = estimates.shape[1]
    boot_est = estimates.values
    cis = np.zeros((num_params, 2))
    theta = outcome(data)
    for k in range(num_params):
        params = boot_est[:, k]
        theta_std = np.std(params)
        tq = _eqf((params - theta[k]) / theta_std)
        t1 = tq(1 - alpha / 2)
        t2 = tq(alpha / 2)
        cis[k, :] = np.array([theta[k] - theta_std * t1, theta[k] - theta_std * t2])
    return cis
def _ci_t ( data , outcome , estimates , alpha , n_cores ) : num_params = estimates . shape [ 1 ] boot_est = estimates . values cis = np . zeros ( ( num_params , 2 ) ) theta = outcome ( data ) for k in range ( num_params ) : params = boot_est [ : , k ] theta_std = np . std ( params ) tq = _eqf ( ( params - theta [ k ] ) / theta_std ) t1 = tq ( 1 - alpha / 2 ) t2 = tq ( alpha / 2 ) cis [ k , : ] = np . array ( [ theta [ k ] - theta_std * t1 , theta [ k ] - theta_std * t2 ] ) return cis
Compute studentized confidence interval of bootstrap estimates.
Compute studentized confidence interval of bootstrap estimates .
"""Compute studentized confidence interval of bootstrap estimates.

    Args:
        data (pd.DataFrame): original dataset.
        outcome (callable): function of the data calculating statistic of interest.
        estimates (data.Frame): DataFrame of estimates in the bootstrap samples.
        alpha (float): significance level of choice.
        n_cores (int): number of jobs for parallelization.

    Returns:
        cis (np.array): array where k'th row contains CI for k'th parameter.

    """
cis (np.array): array where k'th row contains CI for k'th parameter.
cis ( np . array ) : array where k ' th row contains CI for k ' th parameter .
data
None
outcome
function of the data calculating statistic of interest.
function of the data calculating statistic of interest .
estimates
DataFrame of estimates in the bootstrap samples.
DataFrame of estimates in the bootstrap samples .
alpha
significance level of choice.
significance level of choice .
n_cores
number of jobs for parallelization.
number of jobs for parallelization .