This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _stats_py / QuantileTestResult / confidence_interval

function

scipy.stats._stats_py:QuantileTestResult.confidence_interval

source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_stats_py.py:9196

Signature

def confidence_interval(self, confidence_level = 0.95)

Summary

Compute the confidence interval of the quantile.

Parameters

confidence_level : float, default: 0.95

Confidence level for the computed confidence interval of the quantile. Default is 0.95.

Returns

ci : ``ConfidenceInterval`` object

The object has attributes low and high that hold the lower and upper bounds of the confidence interval.

Examples

import numpy as np
import scipy.stats as stats
p = 0.75  # quantile of interest
q = 0  # hypothesized value of the quantile
x = np.exp(np.arange(0, 1.01, 0.01))
res = stats.quantile_test(x, q=q, p=p, alternative='less')
lb, ub = res.confidence_interval()
✓
lb, ub
✗
(np.float64(-inf), np.float64(2.293318740264183))
res = stats.quantile_test(x, q=q, p=p, alternative='two-sided')
lb, ub = res.confidence_interval(0.9)
✓
lb, ub
✗
(np.float64(1.9542373206359396), np.float64(2.293318740264183))

Aliases

  • scipy.stats._stats_py.QuantileTestResult.confidence_interval