正态分布/最大似然估计



from scipy.stats import norm
n1 = norm(loc=0.3, scale=1.0) #<scipy.stats.distributions.rv_frozen at 0x7fc3c45bb610>
n2 = norm(loc=0, scale=1.0)
n1.rvs(size=100) #numpy.array值
loc, scale = norm.fit(samples) #最大似然估计
x = linspace(-3,3,100)

hist([samples, n1_samples, n2_samples], normed=True)
plot(x, n.pdf(x), 'b-')
plot(x, n1.pdf(x), 'g-')
plot(x, n2.pdf(x), 'r-')

参考[数据分析经典参考](http://nbviewer.jupyter.org/github/lijin-thu/notes-python/blob/master/04-scipy/04.03-statistics-with-scipy.ipynb)



猜你喜欢

转载自blog.csdn.net/sinat_26566137/article/details/80070310