pystatpower.proportion.single.ci
¶
| FUNCTION | DESCRIPTION |
|---|---|
solve_distance |
Calculate the confidence interval width or the distance from the proportion to the confidence limit. |
solve_size |
Estimate the required sample size. |
solve_proportion |
Estimate the required proportion. |
solve_distance
¶
solve_distance(
*,
proportion: float,
size: int,
conf_level: float = 0.95,
interval_type: Literal["two-sided", "lower", "upper"] = "two-sided",
method: Literal["wald", "wilson", "clopper-pearson", "cp"] = "cp",
continuity_correction: bool = False,
) -> float
Calculate the confidence interval width or the distance from the proportion to the confidence limit.
| PARAMETER | DESCRIPTION |
|---|---|
proportion
|
Proportion.
TYPE:
|
size
|
Sample size.
TYPE:
|
conf_level
|
Confidence level.
TYPE:
|
interval_type
|
Type of the confidence interval.
TYPE:
|
method
|
The method used to construct the confidence interval.
TYPE:
|
continuity_correction
|
Whether to apply the continuity correction, only takes effect when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The confidence interval width or the distance from the proportion to the confidence limit.
|
solve_size
¶
solve_size(
*,
proportion: float,
distance: float,
conf_level: float = 0.95,
interval_type: Literal["two-sided", "lower", "upper"] = "two-sided",
method: Literal["wald", "wilson", "clopper-pearson", "cp"] = "cp",
continuity_correction: bool = False,
) -> int
Estimate the required sample size.
For two-sided confidence interval, the confidence interval width is required.
For one-sided confidence interval, the distance from the proportion to the confidence limit is required.
| PARAMETER | DESCRIPTION |
|---|---|
proportion
|
Proportion.
TYPE:
|
distance
|
TYPE:
|
conf_level
|
Confidence level.
TYPE:
|
interval_type
|
Type of the confidence interval.
TYPE:
|
method
|
The method used to construct the confidence interval.
TYPE:
|
continuity_correction
|
Whether to apply the continuity correction, only takes effect when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The required sample size. |
solve_proportion
¶
solve_proportion(
*,
size: int,
distance: float,
conf_level: float = 0.95,
interval_type: Literal["two-sided", "lower", "upper"] = "two-sided",
method: Literal["wald", "wilson", "clopper-pearson", "cp"] = "cp",
continuity_correction: bool = False,
direction: Literal["greater", "less"] = "greater",
) -> float
Estimate the required proportion.
For two-sided confidence interval, the confidence interval width is required.
For one-sided confidence interval, the distance from the proportion to the confidence limit is required.
| PARAMETER | DESCRIPTION |
|---|---|
size
|
Sample size.
TYPE:
|
distance
|
TYPE:
|
conf_level
|
Confidence level.
TYPE:
|
interval_type
|
Type of the confidence interval.
TYPE:
|
method
|
The method used to construct the confidence interval.
TYPE:
|
continuity_correction
|
Whether to apply the continuity correction, only takes effect when
TYPE:
|
direction
|
The search direction for the proportion relative to the 0.5.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required proportion. |