使用SciPy的分位数分位数图(Quantile

编程入门 行业动态 更新时间:2024-10-28 20:30:56
使用SciPy的分位数分位数图(Quantile-Quantile Plot using SciPy)

您将如何使用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

enter image description here

更多推荐

本文发布于:2023-08-06 10:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1448318.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位数   SciPy   Quantile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!