pystatpower.models.proportion.single.ci
¶
Functions:
| Name | Description |
|---|---|
solve_size |
Estimate the sample size required to achieve a given confidence interval for one proportion. |
solve_ci_width |
Calculate the confidence interval width for one proportion. |
solve_proportion |
Estimate the proportion required to achieve a given confidence interval for one proportion. |
solve_size
¶
solve_size(proportion: float, ci_width: float, alpha: float = 0.05, method: str = 'clopper_pearson', continuity_correction: bool = False) -> float
Estimate the sample size required to achieve a given confidence interval for one proportion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proportion
|
float
|
Proportion. |
required |
ci_width
|
float
|
Confidence interval width. |
required |
alpha
|
float
|
Significance level. Default is 0.05. |
0.05
|
method
|
str
|
Specify the method for calculating confidence interval. Default is |
'clopper_pearson'
|
continuity_correction
|
bool
|
Specify whether or not the continuity correction is used, only valid for |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
size |
float
|
The required sample size. |
solve_ci_width
¶
solve_ci_width(proportion: float, size: float, alpha: float = 0.05, method: str = 'clopper-pearson', continuity_correction: bool = True) -> float
Calculate the confidence interval width for one proportion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proportion
|
float
|
Proportion. |
required |
size
|
float
|
Sample size. |
required |
alpha
|
float
|
Significance level. Default is 0.05. |
0.05
|
method
|
str
|
Specify the method for calculating confidence interval. Default is |
'clopper-pearson'
|
continuity_correction
|
bool
|
Specify whether or not the continuity correction is used, only valid for |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
ci_width |
float
|
The confidence interval width. |
solve_proportion
¶
solve_proportion(size: float, ci_width: float, alpha: float = 0.05, method: str = 'clopper_pearson', continuity_correction: bool = False, side: str = 'upper') -> float
Estimate the proportion required to achieve a given confidence interval for one proportion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
float
|
Sample size. |
required |
ci_width
|
float
|
Confidence interval width. |
required |
alpha
|
float
|
Significance level. Default is 0.05. |
0.05
|
method
|
str
|
The method for calculating confidence interval. Default is |
'clopper_pearson'
|
continuity_correction
|
bool
|
Whether or not the continuity correction is used, only valid for |
False
|
side
|
str
|
Which root to return. Must be |
'upper'
|
Returns:
| Name | Type | Description |
|---|---|---|
ci_width |
float
|
The confidence interval width. |