aofb_nsigma#
- mqr.spc.rules.aofb_nsigma(a, b, n)#
Rule monitoring the proportion of samples outside a multiple of sigma.
This function returns an alarm rule that alarms when a out of b statistics in a row are beyond n multiples of the statistic standard error. Only the last sample of the b is marked as an alarm.
This function generates a rule. The result of this function is another function that can be passed to
mqr.plot.spc.alarms
orcombine
.- Parameters:
- aint
Intensity – the number of statistics in b periods outside n standard deviations required to trigger an alarm.
- bint
Period – the number of samples to check for a statistics outside n standard deviations required to trigger an alarm.
- nfloat
Threshold in multiples of the standard error.
- 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
The result of this function can be passed to the plotting routines. This example overlays a “4/5 > 2sigma” rule on an X-bar chart.
data = pd.DataFrame({ 'Xbar': np.array([11, 13, 10, 12, 12, 12, 9, 11, 12]) # ^^^^^^^^^^^^^^^^^^ (4/5>=2sigma) }) params = mqr.spc.XBarParams(centre=10, sigma=1) stat = params.statistic(data) rule = mqr.spc.rules.aofb_nsigma(a=4, b=5, n=2) 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
)