Python 中的统计过程控制
Statistical Process Control in Python

原始链接: https://timothyfraser.com/sigma/statistical-process-control-in-python.html

## Python 统计过程控制:摘要 本次研讨会演示了如何使用 Python 中的 `pandas`、`plotnine` 和 `scipy` 库执行统计过程控制 (SPC)。SPC 利用统计方法来监控产品质量随时间的变化,并确定何时需要干预。 示例侧重于日本温泉的质量控制,在温泉中,保持稳定的温度、pH 值和硫磺含量对于旅游业和地方经济至关重要。使用来自鹿儿岛县温泉的数据,该数据每月收集 15 个月,以说明 SPC 技术。 关键步骤包括计算描述性统计数据(平均值、标准差)、创建过程概览图和直方图以可视化数据分布,以及分析子组统计数据(平均值、范围、标准差)。然后生成控制图(X-bar 和 S 图)以监控过程稳定性,识别潜在的“失控”状况。移动范围图用于单个测量值。 通过应用这些方法,操作员可以主动管理温泉质量,确保其符合宣传标准并保持其声誉。本次研讨会提供了实用的 Python 代码和可视化工具,以实现基于数据的过程改进。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Python 中的统计过程控制 (timothyfraser.com) 5 分,来自 lifeisstillgood 48 分钟前 | 隐藏 | 过去 | 收藏 | 讨论 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文
Statistical Process Control!

Figure 2.1: Statistical Process Control!

In this workshop, we will learn how to perform statistical process control in Python, using statistical tools and plotnine visualizations! Statistical Process Control refers to using statistics to (1) measure variation in product quality over time and (2) identify benchmarks to know when intervention is needed. Let’s get started!


Getting Started

Our Case

For today’s workshop, we’re going to think about why quality control matters in a local economy, by examining the case of the Japanese Hot Springs bath economy! Hot springs, or onsen, are a major source of tourism and recreation for families in Japan, bringing residents from across the country every year to often rural communities where the right geological conditions have brought on naturally occurring hot springs. Restaurants, taxi and bus companies, and many service sector firms rely on their local onsen to bring in a steady stream (pun intended) of tourists to the local economy. So, it’s often in the best interest of onsen operators to keep an eye on the temperature, minerals, or other aspects of their hot springs baths to ensure quality control, to keep up their firm (and town’s!) reputation for quality rest and relaxation!

Onsen-goers often seek out specific types of hot springs, so it’s important for an onsen to actually provide what it advertises! Serbulea and Payyappallimana (2012) describe some of these benchmarks.

  • Temperature: Onsen are divided into “Extra Hot Springs” (>42°C), “Hot Springs” (41~34°C), and “Warm Springs” (33~25°C).

  • pH: Onsen are classified into “Acidic” (pH < 3), “Mildly Acidic” (pH 3~6), “Neutral” (pH 6~7.5), “Mildly alkaline” (pH 7.5~8.5), and “Alkaline” (pH > 8.5).

  • Sulfur: Sulfur onsen typically have about 2mg of sulfur per 1kg of hot spring water; sulfur levels must exceed 1 mg to count as a Sulfur onsen. (It smells like rotten eggs!)

These are decent examples of quality control metrics that onsen operators might want to keep tabs on!

Monkeys are even fans of onsen! Read [**more here!**](https://www.nytimes.com/2018/04/03/science/japan-monkeys-hot-springs-stress.html)

Figure 4.1: Monkeys are even fans of onsen! Read more here!

Subgroup (Within-Group) Statistics

In SPC, we often work with subgroups - small samples taken at regular intervals. This allows us to distinguish between common cause variation (inherent to the process) and special cause variation (due to specific events). Let’s calculate statistics for each subgroup to see how the process behaves over time.

##    time    xbar    r        sd    nw    df   sigma_s        se      upper      lower
## 0     1  44.635  4.2  1.342533  20.0  19.0  1.986174  0.444122  46.182366  43.517634
## 1     3  45.305  7.9  2.001440  20.0  19.0  1.986174  0.444122  46.182366  43.517634
## 2     5  44.765  5.9  1.628133  20.0  19.0  1.986174  0.444122  46.182366  43.517634

Here we’ve calculated key statistics for each subgroup:

  • xbar: The mean of each subgroup
  • r: The range (max - min) within each subgroup
  • sd: The standard deviation within each subgroup
  • sigma_s: The pooled within-subgroup standard deviation
  • se: The standard error for each subgroup mean
联系我们 contact @ memedata.com