通常の分布の3つの数値をプロットしようとしていますが、私は1つの良い数字(英国)しか得ていません。残りの2つ(米国と日本)は、正常な曲線が不完全です。複数のプロットを作成するとき、フィット分布がカットされます
グラフをヒストグラムに当てはめたので、それぞれの図が2つのグラフ、つまりヒストグラムとガウス分布を保持する必要があると言えるでしょう。
私のコードの一部を見て、これを修正する方法を教えてください。 私は非常に提案、感謝に感謝しています。
マイmatplotlibの数字:fitted distribution、fitted distribution、
for item in totalIPs:
USA=totalIPs[18]
JAPAN=totalIPs[10]
UK=totalIPs[17]
AUSTRALIA=totalIPs[0]
#print(USA)
#print(JAPAN)
#print(UK)
#print(AUSTRALIA)
#print('done')
#print(country)
#print(ipFirmnames)
#print(totalIPs)
#print("done")
#Calculating mean and standard deviation
#from sublists in country list of lists
#i could write a function for this but dont know how
mu_USA=statistics.mean(USA)
mu_JAPAN=statistics.mean(JAPAN)
mu_UK=statistics.mean(UK)
std_USA=statistics.stdev(USA)
std_JAPAN=statistics.stdev(JAPAN)
std_UK=statistics.stdev(UK)
plt.figure(1)
plt.hist(USA, bins=10, normed=True, alpha=0.6, color='g')
plt.figure(2)
plt.hist(JAPAN,bins=10,normed=True,alpha=0.6, color ='g')
plt.figure(3)
plt.hist(UK, bins=10,normed=True, alpha=0.6, color = 'g')
standardize_USA=(np.array(USA)-mu_USA)/std_USA
standardize_JAPAN=(np.array(JAPAN)-mu_JAPAN)/std_JAPAN
standardize_UK=(np.array(UK)-mu_UK)/std_UK
xmin, xmax = plt.xlim()
x1=np.linspace(xmin, xmax, 100)
x2=np.linspace(xmin, xmax, 100)
x3=np.linspace(xmin, xmax, 100)
fitted_pdf_USA=ss.norm.pdf(x1,mu_USA, std_USA)
fitted_pdf_JAPAN=ss.norm.pdf(x3,mu_JAPAN, std_JAPAN)
fitted_pdf_UK=ss.norm.pdf(x3,mu_UK, std_UK)
plt.figure(1)
plt.plot(x1, fitted_pdf_USA, 'K', linewidth=2)
plt.figure(2)
plt.plot(x2, fitted_pdf_JAPAN,'K', linewidth=2)
fitted_pdf_JAPAN=ss.norm.pdf(x2,mu_JAPAN, std_JAPAN)
plt.figure(3)
plt.plot(x3, fitted_pdf_UK,'K', linewidth=2)
#plt.show()
print(standardize_USA)
print(standardize_JAPAN)
#print(USA)
print(UK)
print(JAPAN)
これまでのところ私の側からの唯一の提案です:あなたが助けたい問題の[mcve]を提供してください。 – ImportanceOfBeingErnest
アドバイスをいただきありがとうございます。私はPythonとStackoverflowの新機能ですので、私は規約に慣れていません。私は次回のことを心に留めておきます。ところで、私のプロットで問題の原因となっているものの考え方は? – MyWrathAcademia
実際にヘルプが必要であり、私たちはそれを提供する必要があるにしても、私たちがしたいことを理解することは難しいです。 [PyMC](http://docs.pymc.io/notebooks/LKJ.html)には、開始に役立つサンプルコードがあります。既知のフレームワークとステップバイステップのノートブックを使用することで、私たちはあなたを手助けするのに非常に役立ちます。 –