您将如何使用Python创建qq图?
假设您有一大组测量,并且正在使用一些绘制XY坐标值作为输入的绘图功能。 该功能应该将测量的分位数与一些分布(正常,均匀...)的相应分位数进行比较。
所得到的情节让我们在我们的测量中评估遵循假设的分布。
http://en.wikipedia.org/wiki/Quantile-quantile_plot
R和Matlab都为此提供了准备的功能,但我想知道在Python中实现最干净的方法是什么。
How would you create a qq-plot using Python?
Assuming that you have a large set of measurements and are using some plotting function that takes XY-values as input. The function should plot the quantiles of the measurements against the corresponding quantiles of some distribution (normal, uniform...).
The resulting plot lets us then evaluate in our measurement follows the assumed distribution or not.
http://en.wikipedia.org/wiki/Quantile-quantile_plot
Both R and Matlab provide ready made functions for this, but I am wondering what the cleanest method for implementing in in Python would be.
最满意答案
我认为scipy.stats.probplot会做你想要的。 有关详细信息,请参阅文档 。
import numpy as np import pylab import scipy.stats as stats measurements = np.random.normal(loc = 20, scale = 5, size=100) stats.probplot(measurements, dist="norm", plot=pylab) pylab.show()结果
I think that scipy.stats.probplot will do what you want. See the documentation for more detail.
import numpy as np import pylab import scipy.stats as stats measurements = np.random.normal(loc = 20, scale = 5, size=100) stats.probplot(measurements, dist="norm", plot=pylab) pylab.show()Result
更多推荐
发布评论