如何计算数据直方图的充分分布及其保密误差?

2024-05-14 22:07:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要从一组线性回归参数(y=ax+b,我的数据是参数a)中提取一组数据的机密错误

我根据我的数据绘制了历史程序。我在用python。我得到了这个阴谋:

我不擅长统计学。我真的需要建议。我需要检查我的数据的分布情况并提取他们的机密错误:
-如何分析我的结果的时间曲线不足以与直方图的大小? -如何检查分布是否符合正态律,或者我必须使用另一个律

这是我用来绘制正态分布曲线的代码

from scipy import stats
import numpy as np
import matplotlib.pylab as plt
import seaborn as sns

values = [6.460042e-10, 4.173214e-19, 8.806035e-17, 8.826609e-17]
sns.distplot(values)

# find minimum and maximum of xticks, so we know
# where we should compute theoretical distribution
xt = plt.xticks()[0]
xmin, xmax = min(xt), max(xt)
lnspc = np.linspace(xmin, xmax, len(values))

# The normal distribution
m, s = stats.norm.fit(values)  # mean and standard deviation
pdf_g = stats.norm.pdf(lnspc, m, s)  # now get theoretical values in our interval
print('theoretical values in our interval'+str(pdf_g))
plt.plot(lnspc, pdf_g, label="Norm")  # plot it

# exactly same as above
ag,bg,cg = stats.gamma.fit(values)
pdf_gamma = stats.gamma.pdf(lnspc, ag, bg,cg)
plt.plot(lnspc, pdf_gamma, label="Gamma")

ab,bb,cb,db = stats.beta.fit(values)
pdf_beta = stats.beta.pdf(lnspc, ab, bb,cb, db)
plt.plot(lnspc, pdf_beta, label="Beta")

plt.show()

enter image description here 如果你能引导我,我将非常感激


Tags: 数据importpdfplotasstatspltlabel

热门问题