相关疑难解决方法(0)

scipy,对数正态分布 - 参数

我想使用python将对数正态分布拟合到我的数据中scipy.stats.lognormal.fit.根据手册,fit返回shape,loc,scale参数.但是,对数正态分布通常只需要两个参数:均值和标准差.

如何解释scipy fit函数的结果?如何获得mean和std.dev.

python statistics scipy

27
推荐指数
2
解决办法
2万
查看次数

python中的对数正态分布

我在stackoverflow中看到了几个关于如何适应的问题log-normal distribution.我还需要知道两个澄清.

我有一个样本数据,其对数遵循正态分布.所以我可以使用scipy.stats.lognorm.fit(即a log-normal distribution)拟合数据

适合工作正常,也给我标准偏差.这是我的一段代码与结果.

sample = np.log10(data) #taking the log10 of the data

scatter,loc,mean = stats.lognorm.fit(sample) #Gives the paramters of the fit 

x_fit = np.linspace(13.0,15.0,100)
pdf_fitted = stats.lognorm.pdf(x_fit,scatter,loc,mean) #Gives the PDF

print "scatter for data is %s" %scatter
print "mean of data is %s" %mean  
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 结果

scatter for data is 0.186415047243
mean for data is 1.15731050926
Run Code Online (Sandbox Code Playgroud)

From the image you can clearly see that the mean is around 14.2, but what I get …

python statistics scipy

5
推荐指数
1
解决办法
6332
查看次数

Python 中 fitdist 和 histfit 的等价物是什么?

- - 样本 - -

我有一个数据集(示例),其中包含 1维数组中的 1 000 个损坏值(这些值非常小 <1e-6)(请参阅随附的 .json 文件)。样本似乎遵循对数正态分布: 数据集(样本)的直方图及其计数

--- 问题和我已经尝试过的东西 ---

我尝试了这篇文章中的建议,用 Scipy (Python) 将经验分布拟合到理论分布?和这篇文章Scipy:对数正态拟合通过对数正态分布拟合我的数据。这些都不起作用。:(

我总是在 Y 轴上得到一些非常大的东西,如下所示:

绘图拟合分布

这是我在 Python 中使用的代码(data.json文件可以从这里下载):

from matplotlib import pyplot as plt
from scipy import stats as scistats
import json
with open("data.json", "r") as f:
  sample = json.load(f) # load data: a 1000 * 1 array with many small values( < 1e-6)
fig, axis = plt.subplots() …
Run Code Online (Sandbox Code Playgroud)

python matlab matplotlib scipy

4
推荐指数
2
解决办法
1894
查看次数

标签 统计

python ×3

scipy ×3

statistics ×2

matlab ×1

matplotlib ×1