pystatpower.proportion.single.equivalence
¶
| FUNCTION | DESCRIPTION |
|---|---|
solve_power |
Calculate the statistical power. |
solve_size |
Estimate the required sample size. |
solve_power
¶
solve_power(
*,
proportion: float,
null_proportion: float,
margin_lower: float,
margin_upper: float,
size: int,
alpha: float = 0.025,
method: Literal["z-p0", "z-phat"] = "z-phat",
continuity_correction: bool = False,
) -> float
Calculate the statistical power.
| PARAMETER | DESCRIPTION |
|---|---|
proportion
|
Proportion under the alternative hypothesis.
TYPE:
|
null_proportion
|
Proportion under the null hypothesis.
TYPE:
|
margin_lower
|
The lower equivalence margin, must be a negative value.
TYPE:
|
margin_upper
|
The upper equivalence margin, must be a positive value.
TYPE:
|
size
|
Sample size.
TYPE:
|
alpha
|
Significance level. The equivalence test is a two one-sided test, with a significance level of 0.025 being commonly used.
TYPE:
|
method
|
The method used to construct the test statistic.
TYPE:
|
continuity_correction
|
Whether to apply the continuity correction.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The statistical power of the test. |
solve_size
¶
solve_size(
*,
proportion: float,
null_proportion: float,
margin_lower: float,
margin_upper: float,
alpha: float = 0.025,
power: float = 0.8,
method: Literal["z-p0", "z-phat"] = "z-phat",
continuity_correction: bool = False,
) -> int
Estimate the required sample size.
| PARAMETER | DESCRIPTION |
|---|---|
proportion
|
Proportion under the alternative hypothesis.
TYPE:
|
null_proportion
|
Proportion under the null hypothesis.
TYPE:
|
margin_lower
|
The lower equivalence margin, must be a negative value.
TYPE:
|
margin_upper
|
The upper equivalence margin, must be a positive value.
TYPE:
|
alpha
|
Significance level. The equivalence test is a two one-sided test, with a significance level of 0.025 being commonly used.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
method
|
The method used to construct the test statistic.
TYPE:
|
continuity_correction
|
Whether to apply the continuity correction.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The required sample size. |