跳转至

pystatpower.models.mean.single.ci

Functions:

Name Description
solve_half_width

Calculate the half-width of the confidence interval for one mean.

solve_size

Calculate the sample size required for the half-width of one mean confidence interval.

solve_std

Calculate the standard deviation required for the half-width of one mean confidence interval.

solve_half_width

solve_half_width(*, std: float, size: int, conf_level: float = 0.95, interval_type: Literal['one-sided', 'two-sided'] = 'two-sided', method: Literal['z', 't'] = 't') -> float

Calculate the half-width of the confidence interval for one mean.

Parameters:

Name Type Description Default
std float

Standard deviation (\(\sigma\)). If method='t', provide the sample standard deviation (\(S\)).

required
size int

Sample size (\(n\)).

required
conf_level (float, Optional)

Confidence level.

0.95
interval_type Literal['one-sided', 'two-sided']

The type of confidence interval.

'two-sided'
method Literal['z', 't']

The distribution used to construct the confidence interval.

't'

solve_size

solve_size(*, half_width: float, std: float, conf_level: float = 0.95, interval_type: Literal['one-sided', 'two-sided'] = 'two-sided', method: Literal['z', 't'] = 't') -> int

Calculate the sample size required for the half-width of one mean confidence interval.

Parameters:

Name Type Description Default
half_width float

Half-width of the confidence interval (\(d\)).

required
std float

Standard deviation (\(\sigma\)). If method='t', provide the sample standard deviation (\(S\)).

required
conf_level (float, Optional)

Confidence level.

0.95
interval_type Literal['one-sided', 'two-sided']

The type of confidence interval.

'two-sided'
method Literal['z', 't']

The distribution used to construct the confidence interval.

't'

solve_std

solve_std(*, half_width: float, size: int, conf_level: float = 0.95, interval_type: Literal['one-sided', 'two-sided'] = 'two-sided', method: Literal['z', 't'] = 't') -> float

Calculate the standard deviation required for the half-width of one mean confidence interval.

Parameters:

Name Type Description Default
half_width float

Half-width of the confidence interval (\(d\)).

required
size int

Sample size (\(n\)).

required
conf_level (float, Optional)

Confidence level.

0.95
interval_type Literal['one-sided', 'two-sided']

The type of confidence interval.

'two-sided'
method Literal['z', 't']

The distribution used to construct the confidence interval.

't'