Control Charts in Python [closed]

本小妞迷上赌 提交于 2019-12-31 22:27:16

问题


I currently use R routinely for statistical process control. With this I can produce control charts such as EWMA, Shewhart, CUSUM and GAM / Loess smoothing.

Does anyone know of the best way to do these types of charts using Python? I initially looked at scikits.timeseries but it has been canned to contribute to pandas.

I had a look at pandas and although it does have EWMA functionality, I need a little bit more.


回答1:


Just found this package that has not been updated in a while, but works so far in Python 2.7.3 (on 64-bit Windows 7, using pretty up-to-date supporting packages):

In [1]: import spc
In [2]: import matplotlib.pyplot as plt
In [3]: x = [25,19,14,17,25,39,49,6,11,19,13,26,24,32,14,19]
In [4]: cc = spc.Spc(x, spc.CHART_X_MR_X)
In [5]: cc.get_chart()
In [6]: plt.show()

Looks like the 6th point is outside the upper control limit...

In [7]: cc.get_violating_points()
Out[7]: {'1 beyond 3*sigma': [6]}

The package is basically a single init.py file that is only a few hundred source lines, and looks to implement more than a dozen charts, including CUSUM.

Lastly, there is a github project worth keeping an eye on: https://github.com/bwghughes/controlchart



来源:https://stackoverflow.com/questions/9962114/control-charts-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!