Normal Distribution Calculator
计算正态(高斯)分布的概率和百分位数。
常见正态分布覆盖范围:
| Sigma 范围 | 覆盖 | z |
|---|---|---|
| 1σ | 68.27% | ±1.000 |
| 2σ | 95.45% | ±2.000 |
| 3σ | 99.73% | ±3.000 |
| 1.96σ | 95.00% | ±1.960 |
| 2.576σ | 99.00% | ±2.576 |
关于此工具
正态分布(也称为高斯分布或钟形曲线)是统计学中最重要的概率分布之一。它描述了数据如何围绕中心平均值聚集,并在两侧对称地逐渐递减。通过指定平均值和标准差,这个计算器可以帮助您计算任何正态分布的概率和百分位数,对从事统计分析的学生、研究人员和专业人士至关重要。
使用此工具时,输入所需的平均值(均值)和标准差(离散程度),然后计算值落在某个范围内的概率,或找到对应特定百分位数的值。计算器会立即提供累积概率、Z分数和百分位数等级。常见应用包括制造业的质量控制、标准化考试成绩解释、金融中的风险评估以及研究中的假设检验。
常见问题
代码实现
import math
def norm_cdf(x):
"""Standard normal CDF using math.erfc"""
return 0.5 * math.erfc(-x / math.sqrt(2))
def normal_cdf(x, mu=0, sigma=1):
"""Normal CDF with given mean and std dev"""
return norm_cdf((x - mu) / sigma)
def normal_pdf(x, mu=0, sigma=1):
"""Normal probability density function"""
return (1 / (sigma * math.sqrt(2 * math.pi))) * math.exp(-0.5 * ((x - mu) / sigma) ** 2)
# P(X < 1) for standard normal
print(f"P(X < 1) = {norm_cdf(1):.4%}") # 84.1345%
# P(0 < X < 1) for N(0,1)
print(f"P(0<X<1) = {norm_cdf(1) - norm_cdf(0):.4%}") # 34.1345%
# Using scipy for more features
from scipy import stats
mu, sigma = 100, 15 # IQ scores
print(f"P(IQ < 130) = {stats.norm.cdf(130, mu, sigma):.4%}")
print(f"90th percentile IQ = {stats.norm.ppf(0.90, mu, sigma):.1f}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.