histogram.meanCI([options])
使用Student的t分布和样本标准误差返回均值的双侧置信区间。较高的置信水平会产生更宽的区间。该区间假设样本是独立且近似正态分布的,尽管对于足够大的样本,这种近似是稳健的。
🌐 Returns a two-sided confidence interval for the mean using Student's t-distribution and the sample standard error. A higher confidence level produces a wider interval. This interval assumes that samples are independent and approximately normally distributed, although the approximation is robust for sufficiently large samples.
结果反映了直方图配置的精度,并且是根据其桶所表示的值计算得出的。当记录的值少于两个时,lower 和 upper 为 NaN。当所有记录的值相等时,lower 和 upper 等于 mean。
🌐 The result reflects the histogram's configured precision and is calculated
from the values represented by its buckets. With fewer than two recorded
values, lower and upper are NaN. When all recorded values are equal,
lower and upper equal mean.
const { createHistogram } = require('node:perf_hooks');
const h = createHistogram();
for (let i = 1; i <= 100; i++) h.record(i);
const { mean, lower, upper } = h.meanCI();
console.log(`mean=${mean}, 95% CI=[${lower}, ${upper}]`);