跳转至

pystatpower.correlation.ci

FUNCTION DESCRIPTION
solve_distance

Calculate the width of correlation coefficient confidence interval or the distance from the correlation coefficient to the confidence limit.

solve_size

Estimate the required sample size.

solve_distance

solve_distance(
    *,
    correlation: float,
    size: int,
    conf_level: float = 0.95,
    interval_type: Literal["two-sided", "lower", "upper"] = "two-sided",
    bias_adj: bool = False,
) -> float

Calculate the width of correlation coefficient confidence interval or the distance from the correlation coefficient to the confidence limit.

PARAMETER DESCRIPTION
correlation

Correlation coefficient.

TYPE: float

size

Sample size.

TYPE: int

conf_level

Confidence level.

  • If alternative is 'two-sided', a two-sided confidence interval is required.
  • If alternative is 'lower' or 'upper', a one-sided confidence interval is required.

TYPE: float DEFAULT: 0.95

interval_type

Type of the 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'

bias_adj

Whether to adjust for the bias.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
float

The width of correlation coefficient confidence interval or the distance from the correlation coefficient to the confidence limit.

  • If interval_type is 'two-sided', the width of correlation coefficient confidence interval is returned.
  • If interval_type is 'lower' or 'upper', the distance from the correlation coefficient to the confidence limit is returned.

solve_size

solve_size(
    *,
    correlation: float,
    distance: float,
    conf_level: float = 0.95,
    interval_type: Literal["two-sided", "lower", "upper"] = "two-sided",
    bias_adj: bool = False,
) -> int

Estimate the required sample size.

PARAMETER DESCRIPTION
correlation

Correlation coefficient.

TYPE: float

distance

The width of correlation coefficient confidence interval or the distance from the correlation coefficient to the confidence limit.

  • If interval_type = 'two-sided', the width of correlation coefficient two-sided confidence interval id required.
  • If interval_type = 'lower', the distance from the correlation coefficient to the lower one-sided confidence limit is required.
  • If interval_type = 'upper', the distance from the correlation coefficient to the upper one-sided confidence limit is required.

TYPE: float

conf_level

Confidence level.

  • If alternative is 'two-sided', a two-sided confidence interval is required.
  • If alternative is 'lower' or 'upper', a one-sided confidence interval is required.

TYPE: float DEFAULT: 0.95

interval_type

Type of the 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'

bias_adj

Whether to adjust for bias.

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
int

The required sample size.