credible.frequentist.utils¶
Frequentist confidence interval estimation.
(Frequentist) confidence interval interpretation, with 95% coverage: If we are to take several independent random samples from the population and construct confidence intervals from each of the sample data, then 95 out of 100 confidence intervals will contain the true mean (true proportion, in this context of proportion).
See a discussion in Five Confidence Intervals for Proportions That You Should Know About.
Functions
|
Calculate the confidence interval for proportion estimates. |
|
|
|
Calculate the "exact" confidence interval for proportion estimates. |
|
|
|
Calculate the confidence interval for proportion estimates. |
|
|
- credible.frequentist.utils.clopper_pearson_array(successes, failures, coverage)[source]¶
clopper_pearson(), for multiple systems.- Parameters:
- Return type:
tuple[ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]]]- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.
- credible.frequentist.utils.clopper_pearson(successes, failures, coverage=0.95)[source]¶
Calculate the “exact” confidence interval for proportion estimates.
The Clopper-Pearson interval method is used for estimating the confidence intervals. This implementation is based on [CLOPPER-1934]. This technique is very conservative - in most of the cases, coverage is greater than the required value, which may imply in too large confidence intervals.
- Parameters:
- Return type:
- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.
- credible.frequentist.utils.agresti_coull_array(successes, failures, coverage)[source]¶
agresti_coull(), for multiple systems.- Parameters:
- Return type:
tuple[ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]]]- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.
- credible.frequentist.utils.agresti_coull(successes, failures, coverage=0.95)[source]¶
Calculate the confidence interval for proportion estimates.
The Agresti-Coull interval method is used for estimating the confidence intervals. This implementation is based on [AGRESTI-1998]. This technique is conservative - in most of the cases, coverage is greater than the required value, which may imply a larger confidence interval that required.
This function is considered a good choice for the frequentist approach, if you cannot use
clopper_pearson().- Parameters:
- Return type:
- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.
- credible.frequentist.utils.wilson_array(successes, failures, coverage)[source]¶
wilson(), for multiple systems.- Parameters:
- Return type:
tuple[ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]],ndarray[tuple[int,...],dtype[float64]]]- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.
- credible.frequentist.utils.wilson(successes, failures, coverage=0.95)[source]¶
Calculate the confidence interval for proportion estimates.
The Wilson interval method is used for estimating the confidence intervals. This implementation is based on [WILSON-1927]. This implementation does not contain the continuity correction. It is as conservative in the extremes of the domain as the bayesian approach and can be a good default, if
clopper_pearson()cannot be used.This function is considered the best “default” for the frequentist approach as it is not too conservative and assumes a resonable value through out the range.
- Parameters:
- Return type:
- Returns:
The estimated ratio between successes, and total trials (successes plus failures), lower and upper bounds of the confidence interval, in this order.
- Raises:
TypeError – If the dimensions of
successesandfailuresdo not match, or in case the input types are unsupported.