pystatpower.mean.independent.ci
¶
Functions:
| Name | Description |
|---|---|
solve_precision |
Calculate the distance from the mean difference to the confidence limit. |
solve_size |
Estimate the required sample size, given the distance from the mean difference to the confidence limit. |
solve_precision
¶
solve_precision(
*,
treatment_std: float,
reference_std: float,
treatment_size: int,
reference_size: int,
conf_level: float = 0.95,
interval_type: Literal[
"two-sided", "lower", "upper"
] = "two-sided",
equal_var: bool = False,
) -> float
Calculate the distance from the mean difference to the confidence limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
treatment_std
|
float
|
Standard deviation in the treatment group. |
required |
reference_std
|
float
|
Standard deviation in the reference group. |
required |
treatment_size
|
int
|
Sample size in the treatment group. |
required |
reference_size
|
int
|
Sample size in the reference group. |
required |
conf_level
|
float
|
Confidence level. |
0.95
|
interval_type
|
Literal['two-sided', 'lower', 'upper']
|
The type of confidence interval.
|
'two-sided'
|
equal_var
|
bool
|
Specify whether the variances are assumed to be equal.
|
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The distance from the mean difference to the confidence limit. |
solve_size
¶
solve_size(
*,
treatment_std: float,
reference_std: float,
precision: float,
ratio: float = 1,
conf_level: float = 0.95,
interval_type: Literal[
"two-sided", "lower", "upper"
] = "two-sided",
equal_var: bool = False,
) -> tuple[int, int]
Estimate the required sample size, given the distance from the mean difference to the confidence limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
treatment_std
|
float
|
Standard deviation in the treatment group. |
required |
reference_std
|
float
|
Standard deviation in the reference group. |
required |
precision
|
float
|
The distance from the mean difference to the confidence limit. |
required |
ratio
|
float
|
The ratio of the sample size in the treatment group to the sample size in the reference group. |
1
|
conf_level
|
float
|
Confidence level. |
0.95
|
interval_type
|
Literal['two-sided', 'lower', 'upper']
|
The type of confidence interval.
|
'two-sided'
|
equal_var
|
bool
|
Specify whether the variances are assumed to be equal.
|
False
|
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
tuple[int, int]: The required sample size in the treatment and reference groups, respectively. |