pystatpower.mean.single.superiority
¶
| FUNCTION | DESCRIPTION |
|---|---|
solve_power |
Calculate the statistical power. |
solve_size |
Estimate the required sample size. |
solve_mean |
Estimate the required mean under the alternative hypothesis. |
solve_null_mean |
Estimate the required mean under the null hypothesis. |
solve_margin |
Estimate the required superiority margin. |
solve_diff |
Estimate the required mean difference. |
solve_superiority_mean |
Estimate the required superiority mean. |
solve_offset |
Estimate the required offset. |
solve_std |
Estimate the required standard deviation. |
solve_power
¶
solve_power(
*,
mean: float | None = None,
null_mean: float | None = None,
margin: float | None = None,
diff: float | None = None,
superiority_mean: float | None = None,
offset: float | None = None,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
dist: Literal["z", "t"] = "t",
) -> float
Calculate the statistical power.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis. This parameter must be used together with
TYPE:
|
null_mean
|
Mean under the null hypothesis. This parameter must be used together with
TYPE:
|
margin
|
The superiority margin. This parameter must be used together with
Tip Regardless of whether
TYPE:
|
diff
|
Difference between the mean under the alternative hypothesis and the mean under the null hypothesis. This parameter must be used together with
TYPE:
|
superiority_mean
|
The superiority mean.
This parameter must be used together with
TYPE:
|
offset
|
The offset, defined as the difference between the mean under the alternative hypothesis and the superiority mean. If you specify this parameter, all of
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a one-sided test, with a significance level of 0.025 being commonly used.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The statistical power of the test. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
The given set of parameters is insufficient to determine the offset. |
solve_size
¶
solve_size(
*,
mean: float | None = None,
null_mean: float | None = None,
margin: float | None = None,
diff: float | None = None,
superiority_mean: float | None = None,
offset: float | None = None,
std: float,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> int
Estimate the required sample size.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis. This parameter must be used together with
TYPE:
|
null_mean
|
Mean under the null hypothesis. This parameter must be used together with
TYPE:
|
margin
|
The superiority margin. This parameter must be used together with
Tip Regardless of whether
TYPE:
|
diff
|
Difference between the mean under the alternative hypothesis and the mean under the null hypothesis. This parameter must be used together with
TYPE:
|
superiority_mean
|
The superiority mean.
This parameter must be used together with
TYPE:
|
offset
|
The offset, defined as the difference between the mean under the alternative hypothesis and the superiority mean. If you specify this parameter, all of
TYPE:
|
std
|
Standard deviation.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The required sample size. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
The given set of parameters is insufficient to determine the offset. |
solve_mean
¶
solve_mean(
*,
null_mean: float | None = None,
margin: float | None = None,
superiority_mean: float | None = None,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required mean under the alternative hypothesis.
| PARAMETER | DESCRIPTION |
|---|---|
null_mean
|
Mean under the null hypothesis. This parameter must be used together with
TYPE:
|
margin
|
The superiority margin. This parameter must be used together with
Tip Regardless of whether
TYPE:
|
superiority_mean
|
The superiority mean.
If you specify this parameter, both
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required mean under the alternative hypothesis. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
The given set of parameters is insufficient to determine the superiority mean. |
solve_null_mean
¶
solve_null_mean(
*,
mean: float,
margin: float,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required mean under the null hypothesis.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis.
TYPE:
|
margin
|
The superiority margin. Tip Regardless of whether
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required mean under the null hypothesis. |
solve_margin
¶
solve_margin(
*,
mean: float | None = None,
null_mean: float | None = None,
diff: float | None = None,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required superiority margin.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis. This parameter must be used together with
TYPE:
|
null_mean
|
Mean under the null hypothesis. This parameter must be used together with
TYPE:
|
diff
|
Mean difference between the alternative hypothesis and the null hypothesis. If you specify this parameter, both
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required superiority margin.
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
The given set of parameters is insufficient to determine the mean difference. |
solve_diff
¶
solve_diff(
*,
margin: float,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required mean difference.
| PARAMETER | DESCRIPTION |
|---|---|
margin
|
The superiority margin. Tip Regardless of whether
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required mean difference between the alternative hypothesis and the null hypothesis. |
solve_superiority_mean
¶
solve_superiority_mean(
*,
mean: float,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required superiority mean.
- If
alternativeis'greater', the superiority mean is defined as the smallest mean that exceeds the null hypothesis mean and is considered superior. - If
alternativeis'less', the superiority mean is defined as the largest mean that falls below the null hypothesis mean and is considered superior.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis.
TYPE:
|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required superiority mean. |
solve_offset
¶
solve_offset(
*,
std: float,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required offset.
The offset is defined as the difference between the mean under the alternative hypothesis and the superiority mean.
| PARAMETER | DESCRIPTION |
|---|---|
std
|
Standard deviation.
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required offset. |
solve_std
¶
solve_std(
*,
mean: float | None = None,
null_mean: float | None = None,
margin: float | None = None,
diff: float | None = None,
superiority_mean: float | None = None,
offset: float | None = None,
size: int,
alternative: Literal["greater", "less"],
alpha: float = 0.025,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required standard deviation.
| PARAMETER | DESCRIPTION |
|---|---|
mean
|
Mean under the alternative hypothesis. This parameter must be used together with
TYPE:
|
null_mean
|
Mean under the null hypothesis. This parameter must be used together with
TYPE:
|
margin
|
The superiority margin. This parameter must be used together with
Tip Regardless of whether
TYPE:
|
diff
|
Difference between the mean under the alternative hypothesis and the mean under the null hypothesis. This parameter must be used together with
TYPE:
|
superiority_mean
|
The superiority mean.
This parameter must be used together with
TYPE:
|
offset
|
The offset, defined as the difference between the mean under the alternative hypothesis and the superiority mean. If you specify this parameter, all of
TYPE:
|
size
|
Sample size.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level. The superiority test is a 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:
|
dist
|
The distribution used for the test.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required standard deviation. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
The given set of parameters is insufficient to determine the offset. |