mqr.spc.rules.
n_trending#
- mqr.spc.rules.n_trending(n)#
Rule monitoring the count of trending points.
This function returns an alarm rule that alarms when n statistics in a row trend (up or down).
This function generates a rule. The result of this function is another function that can be passed to
mqr.plot.spc.alarms
orcombine
.- Parameters:
- nint
Number of sample in a trend required to cause an alarm.
- Returns:
- Callable[(ControlStatistic, ControlParams), pandas.Series[bool]]
A function taking a control statistic and the params used to create them, and returning a series with True marking alarms.
Examples
data = pd.DataFrame({ 'Xbar': np.array([11, 9, 12, 10, 9, 8, 12]) # ^^^^^^^^^^^^ (4 trending) }) params = mqr.spc.XBarParams(centre=10, sigma=1) stat = params.statistic(data) rule = mqr.spc.rules.n_trending(4) fig, ax = plt.subplots(figsize=(7, 3)) mqr.plot.spc.chart(stat, params, ax=ax) mqr.plot.spc.alarms(stat, params, rule, ax=ax)
(
Source code
,png
,pdf
)