spc_ewma — SPC change op

• 資料種類:signal → table

• 呼叫: import fullseye as fs; fs.ledger.spc_ewma(signal, target, lam=0.2, L=3.0, sigma=None)(要直接呼叫實作,import spc; spc.spc_ewma(signal, target, lam=0.2, L=3.0, sigma=None);從台帳取用則 opsspc.get("spc_ewma"))

用法

> 該運算子的說明尚無譯文,以下照原文給出。

EWMA control chart for individual measurements (Roberts 1959).

signal is a 1-D series of individual measurements. With a reference value target (the in-control mean), a smoothing constant lam in (0, 1] and a control-limit width L (in sigmas), the exponentially weighted moving average and its time-varying limits are::

z_i = lam * x_i + (1 - lam) * z_{i-1}, z_0 = target

var_i = sigma^2 * (lam / (2 - lam)) * (1 - (1 - lam) ** (2 (i + 1)))

UCL_i / LCL_i = target +/- L * sqrt(var_i)

sigma is the process standard deviation; if None it is estimated from the series as the sample std (ddof=1). The limits widen from the first sample to the asymptote target +/- L * sigma * sqrt(lam / (2 - lam)). EWMA, like CUSUM, catches small sustained shifts that a single-point Shewhart chart misses; lam trades memory (small = long memory, sensitive to small shifts) against speed.

Returns a dict with the z / ucl / lcl arrays, the integer alarms indices (z_i outside its limits), the first alarm index (or -1), the asymptotic ucl_inf / lcl_inf, and the echoed target / lam / L / sigma / in_control.

Ground truth (pinned in the tests): a series constant at target keeps z == target with no alarm; z is exactly the recursion above; ucl increases monotonically toward ucl_inf; with lam = 1 the chart reduces to a Shewhart individuals chart (z == x, limits constant at target +/- L sigma).

Raises ValueError: a non-1-D / empty *signal*, a non-finite *target* / *lam* / *L*, lam outside (0, 1], a non-positive *L*, a non-finite or non-positive *sigma*, or (when estimating) a constant series whose sample std is zero.

參考(範例資料、文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

• 演算法的正典(作者、年份)與用途見上面的族使用指南。

可執行的範例(實際呼叫該運算子並已驗證的樣例)

• poc_spc — py -3.11 examples/poc_spc.py

型別可銜接的下一個運算子(可接受 table 作為輸入)

msa_anova_table · msa_gauge_rr · msa_bias_linearity · msa_attribute_agreement · gum_standard_uncertainty · gum_propagate · gum_expanded · gum_monte_carlo

同類別(change)

spc_cusum


*Provenance: spc.py — SPC 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.