统计学解释
上次我们介绍了标准正态分布概率计算的方法,现在我们来计算任意正态分布的概率计算方法。
首先需要将正态分布通过线性变换将它转化为标准正态分布,其变换公式如下:
![919329880450d69aa291eccffbe8e732.png](https://img-blog.csdnimg.cn/img_convert/919329880450d69aa291eccffbe8e732.png)
其中μ为正态分布的均值,σ为标准差;N(0,1)表示服从于均值为0,标准差为1的标准正态分布。
实现代码
1.引入计算标准正态分布累积概率的代码
import mathdef st_normal_distribution(x): #处理x<0(目标点在分布中心左侧)的情况 if x<0: return 1-normal_distribution(-x) if x==0: return 0.5 #求标准正态分布的概率密度的积分 s=1/10000 xk=[] for i in range(1,x*10000): xk.append(i*s) integral=(fx_normal_distribution(0)+fx_normal_distribution(x))/2 #f(0)和f(x)各算一半 for each in xk: integral+=fx_normal_distribution(each) return 0.5+integral*s def fx_st_normal_distribution(x):return math.exp((-(x)**2)/2)/(math.sqrt(2*math.pi))
(以上函数的实现&#