pystatpower.mean.single.ci
¶
Functions:
| Name | Description |
|---|---|
solve_precision |
Calculate the distance from the single-group mean to the confidence limit (commonly known as precision). |
solve_size |
Estimate the required sample size, given the distance from the single-group mean to the confidence limit (commonly known as precision). |
solve_std |
Estimate the required standard deviation, given the distance from the single-group mean to the confidence limit (commonly known as precision). |
solve_precision
¶
solve_precision(
*,
std: float,
size: int,
conf_level: float = 0.95,
interval_type: Literal[
"two-sided", "one-sided", "lower", "upper"
] = "two-sided",
dist: Literal["z", "t"] = "t",
) -> float
Calculate the distance from the single-group mean to the confidence limit (commonly known as precision).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
std
|
float
|
Standard deviation. |
required |
size
|
int
|
Sample size. |
required |
conf_level
|
float
|
Confidence level.
|
0.95
|
interval_type
|
Literal['two-sided', 'one-sided', 'lower', 'upper']
|
The type of confidence interval.
|
'two-sided'
|
dist
|
Literal['z', 't']
|
The distribution used to construct the confidence interval.
|
't'
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The distance from the single-group mean to the confidence limit (commonly known as precision). |
Notes
Since the confidence interval for the single-group mean is symmetric, specifying interval_type as 'lower', 'upper', or 'one-sided' works consistently.
solve_size
¶
solve_size(
*,
precision: float,
std: float,
conf_level: float = 0.95,
interval_type: Literal[
"two-sided", "one-sided", "lower", "upper"
] = "two-sided",
dist: Literal["z", "t"] = "t",
) -> int
Estimate the required sample size, given the distance from the single-group mean to the confidence limit (commonly known as precision).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precision
|
float
|
Distance from the single-group mean to the confidence limit. |
required |
std
|
float
|
Standard deviation. |
required |
conf_level
|
float
|
Confidence level.
|
0.95
|
interval_type
|
Literal['two-sided', 'one-sided', 'lower', 'upper']
|
The type of confidence interval.
|
'two-sided'
|
dist
|
Literal['z', 't']
|
The distribution used to construct the confidence interval.
|
't'
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The required sample size. |
Notes
Since the confidence interval for the single-group mean is symmetric, specifying interval_type as 'lower', 'upper', or 'one-sided' works consistently.
solve_std
¶
solve_std(
*,
precision: float,
size: int,
conf_level: float = 0.95,
interval_type: Literal[
"two-sided", "one-sided", "lower", "upper"
] = "two-sided",
dist: Literal["z", "t"] = "t",
) -> float
Estimate the required standard deviation, given the distance from the single-group mean to the confidence limit (commonly known as precision).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
precision
|
float
|
Distance from the single-group mean to the confidence limit. |
required |
size
|
int
|
Sample size. |
required |
conf_level
|
float
|
Confidence level.
|
0.95
|
interval_type
|
Literal['two-sided', 'one-sided', 'lower', 'upper']
|
The type of confidence interval.
|
'two-sided'
|
dist
|
Literal['z', 't']
|
The distribution used to construct the confidence interval.
|
't'
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The required standard deviation. |
Notes
Since the confidence interval for the single-group mean is symmetric, specifying interval_type as 'lower', 'upper', or 'one-sided' works consistently.