pystatpower.mean.independent.inequality
¶
| FUNCTION | DESCRIPTION |
|---|---|
solve_power |
Calculate the statistical power. |
solve_size |
Estimate the required sample size. |
solve_diff |
Estimate the required mean difference. |
solve_treatment_mean |
Estimate the required mean in the treatment group. |
solve_reference_mean |
Estimate the required mean in the reference group. |
solve_treatment_std |
Estimate the required standard deviation in the treatment group. |
solve_reference_std |
Estimate the required standard deviation in the reference group. |
solve_power
¶
solve_power(
*,
treatment_mean: float | None = None,
reference_mean: float | None = None,
diff: float | None = None,
treatment_std: float | None = None,
reference_std: float | None = None,
std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
dist: Literal["z", "t"] = "t",
equal_var: bool = False,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
) -> float
Calculate the statistical power.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_mean
|
Mean in the treatment group. If
TYPE:
|
reference_mean
|
Mean in the reference group. If
TYPE:
|
diff
|
Mean difference between treatment and reference group. If both
TYPE:
|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
std
|
Standard deviation in both groups. This is a convenience parameter that will override If you specify
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The calculated statistical power of the test. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If all of |
ValueError
|
If |
ValueError
|
If |
solve_size
¶
solve_size(
*,
treatment_mean: float | None = None,
reference_mean: float | None = None,
diff: float | None = None,
treatment_std: float | None = None,
reference_std: float | None = None,
std: float | None = None,
ratio: float = 1,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = False,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
) -> tuple[int, int]
Estimate the required sample size.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_mean
|
Mean in the treatment group. If
TYPE:
|
reference_mean
|
Mean in the reference group. If
TYPE:
|
diff
|
Mean difference between treatment and reference group. If both
TYPE:
|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
std
|
Standard deviation in both groups. This is a convenience parameter that will override If you specify
TYPE:
|
ratio
|
Ratio of sample sizes in the treatment and reference groups.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Desired statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, int]
|
The required sample sizes in the treatment and reference groups, respectively. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If all of |
ValueError
|
If |
ValueError
|
If |
solve_diff
¶
solve_diff(
*,
treatment_std: float | None = None,
reference_std: float | None = None,
std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = False,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
direction: Literal["greater", "less"] | None = None,
) -> float
Estimate the required mean difference.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
std
|
Standard deviation in both groups. This is a convenience parameter that will override If you specify
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
direction
|
The search direction for the mean difference relative to zero.
Note
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required difference between the treatment and reference means. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
solve_treatment_mean
¶
solve_treatment_mean(
*,
reference_mean: float,
treatment_std: float | None = None,
reference_std: float | None = None,
std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = False,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
direction: Literal["greater", "less"] | None = None,
) -> float
Estimate the required mean in the treatment group.
| PARAMETER | DESCRIPTION |
|---|---|
reference_mean
|
Mean in the reference group.
TYPE:
|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
std
|
Standard deviation in both groups. This is a convenience parameter that will override If you specify
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
direction
|
The search direction for the treatment mean relative to the reference mean.
Note
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required mean in the treatment group. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
solve_reference_mean
¶
solve_reference_mean(
*,
treatment_mean: float,
treatment_std: float | None = None,
reference_std: float | None = None,
std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = False,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
direction: Literal["greater", "less"] | None = None,
) -> float
Estimate the required mean in the reference group.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_mean
|
Mean in the treatment group.
TYPE:
|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
std
|
Standard deviation in both groups. This is a convenience parameter that will override If you specify
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
direction
|
The search direction for the reference mean relative to the treatment mean.
Note
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required mean in the treatment group. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
ValueError
|
If |
ValueError
|
If |
solve_treatment_std
¶
solve_treatment_std(
*,
treatment_mean: float | None = None,
reference_mean: float | None = None,
diff: float | None = None,
reference_std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = True,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
) -> float
Estimate the required standard deviation in the treatment group.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_mean
|
Mean in the treatment group. If
TYPE:
|
reference_mean
|
Mean in the reference group. If
TYPE:
|
diff
|
Mean difference between treatment and reference group. If both
TYPE:
|
reference_std
|
Standard deviation in the reference group.
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required standard deviation in the treatment group. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If all of |
ValueError
|
If |
solve_reference_std
¶
solve_reference_std(
*,
treatment_mean: float | None = None,
reference_mean: float | None = None,
diff: float | None = None,
treatment_std: float | None = None,
treatment_size: int,
reference_size: int,
alternative: Literal["two-sided", "greater", "less"] = "two-sided",
alpha: float = 0.05,
power: float = 0.8,
dist: Literal["z", "t"] = "t",
equal_var: bool = True,
approx_t_method: Literal["welch", "satterthwaite"] = "welch",
) -> float
Estimate the required standard deviation in the reference group.
| PARAMETER | DESCRIPTION |
|---|---|
treatment_mean
|
Mean in the treatment group. If
TYPE:
|
reference_mean
|
Mean in the reference group. If
TYPE:
|
diff
|
Mean difference between treatment and reference group. If both
TYPE:
|
treatment_std
|
Standard deviation in the treatment group.
TYPE:
|
treatment_size
|
Sample size in the treatment group.
TYPE:
|
reference_size
|
Sample size in the reference group.
TYPE:
|
alternative
|
Type of the alternative hypothesis.
TYPE:
|
alpha
|
Significance level.
TYPE:
|
power
|
Expected statistical power. 0.8 is a commonly used value for statistical power.
TYPE:
|
dist
|
The distribution used for the test.
TYPE:
|
equal_var
|
Whether to assume equal variances between treatment and reference groups.
TYPE:
|
approx_t_method
|
Approximate t-test method. It is used when
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
The required standard deviation in the reference group. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If all of |
ValueError
|
If |