跳转至

pystatpower.mean.independent.ci

FUNCTION DESCRIPTION
solve_precision

Calculate the distance from the mean difference to the confidence limit.

solve_size

Estimate the required sample size.

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.

PARAMETER DESCRIPTION
treatment_std

Standard deviation in the treatment group.

TYPE: float

reference_std

Standard deviation in the reference group.

TYPE: float

treatment_size

Sample size in the treatment group.

TYPE: int

reference_size

Sample size in the reference group.

TYPE: int

conf_level

Confidence level.

TYPE: float DEFAULT: 0.95

interval_type

The type of confidence interval.

  • 'two-sided': Two-sided confidence interval.
  • 'lower': Lower one-sided confidence interval.
  • 'upper': Upper one-sided confidence interval.

TYPE: Literal['two-sided', 'lower', 'upper'] DEFAULT: 'two-sided'

equal_var

Specify whether the variances are assumed to be equal.

  • True: The variances are assumed to be equal. In this case, the standard t-test is used.
  • False: The variances are not assumed to be equal. In this case, Welch-Satterthwaite's approximate t-test is used.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
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.

PARAMETER DESCRIPTION
treatment_std

Standard deviation in the treatment group.

TYPE: float

reference_std

Standard deviation in the reference group.

TYPE: float

precision

The distance from the mean difference to the confidence limit.

TYPE: float

ratio

The ratio of the sample size in the treatment group to the sample size in the reference group.

TYPE: float DEFAULT: 1

conf_level

Confidence level.

TYPE: float DEFAULT: 0.95

interval_type

The type of confidence interval.

  • 'two-sided': Two-sided confidence interval.
  • 'lower': Lower one-sided confidence interval.
  • 'upper': Upper one-sided confidence interval.

TYPE: Literal['two-sided', 'lower', 'upper'] DEFAULT: 'two-sided'

equal_var

Specify whether the variances are assumed to be equal.

  • True: The variances are assumed to be equal. In this case, the standard t-test is used.
  • False: The variances are not assumed to be equal. In this case, Welch-Satterthwaite's approximate t-test is used.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
tuple[int, int]

The required sample sizes in the treatment and reference groups, respectively.