Main Content

controlrules

Western Electric and Nelson control rules

Description

R = controlrules(rules,X,cl,se) returns violation indicators for the points in the numeric vector X, using the rules in rules, center line values cl, and standard errors se.rules can contain a combination of Western Electric and Nelson control rules.

example

[R,appliedRules] = controlrules(rules,X,cl,se) additionally returns a cell array containing the names of the applied control rules.

Examples

collapse all

Load the parts data set.

load parts;

Create an X-bar chart using the controlchart function. Specify the we4 rule to mark out-of-control measurements. Return the subgroup statistics and plot data.

[stats,plotted] = controlchart(runout,rules="we4");

Figure contains an axes object. The axes object with title X-Bar Control Chart, ylabel X-Bar contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent Data, Violation, Center, LCL/UCL.

The red lines in the chart indicate the control limits, and out-of-control points are marked with a red circle. Display the subgroup numbers of the out-of-control points.

find(plotted.ooc)
ans = 4×1

     2
    21
    25
    27

Identify the measurements that violate the we4 control rule by displaying the indices of the non-zero values returned by the controlrules function.

R = controlrules("we4",plotted.pts,plotted.cl(1),plotted.se(1));
I = find(R)
I = 
27

The subgroups 2, 21, and 25 are out of control because they are outside the control limits. Subgroup 27 violates the we4 control rule because it is the last of eight consecutive points that lie above the center line.

Input Arguments

collapse all

Control rules, specified as a character vector, string scalar, string array, or cell array of character vectors containing one or more of the following values. Note that values containing "we" are Western Electric rules, and values containing "n" are Nelson rules.

ValueViolation Condition
"we1"

One point above cl + 3*se

"we2"

Two of three points above cl + 2*se

"we3"

Four of five points above cl + se

"we4"Eight of eight points above cl
"we5"

One point below cl 3*se

"we6"

Two of three points below cl 2*se

"we7"

Four of five points below cl se

"we8"Eight of eight points below cl
"we9"

Fifteen of fifteen points between cl se and cl + se

"we10"

Eight of eight points below cl se or above cl + se

"n1"

One point below cl 3*se or above cl + 3*se

"n2"Nine of nine points on the same side of cl
"n3"Six of six points increasing or decreasing
"n4"Fourteen points alternating up or down
"n5"

Two of three points below cl 2*se or above cl + 2*se, all on the same side

"n6"

Four of five points below cl se or above cl + se, all on the same side

"n7"

Fifteen of fifteen points between cl se and cl + se

"n8"

Eight of eight points below cl se or above cl + se, on either side

"we"All Western Electric rules
"n"All Nelson rules

For the control rules that involve more than a single point:

  • A rule violation at point i indicates that the set of consecutive points ending at point i triggers the rule. R(i) is true only if point i is one of the points that violates the rule's condition.

  • Any point whose X, cl, or se value is NaN is not counted and always has an R value of false (logical 0).

Data Types: char | string

Points to evaluate, specified as a numeric vector.

Data Types: single | double

Center lines, specified as a numeric vector that has the same length as X. You can also specify cl as a numeric scalar, in which case the function uses the same value for all points.

Data Types: single | double

Standard errors, specified as a numeric vector that has the same length as X. You can also specify se as a numeric scalar, in which case the function uses the same value for all points.

Data Types: single | double

Output Arguments

collapse all

Control rule violation indicators, returned as a logical matrix or vector. The function returns indicators for the points in X, using the rules in rules, center line values cl, and standard errors se. If X contains n points and rules contains m rules, then R is an n-by-m logical matrix, where R(i,j) has the value true (logical 1) if point i violates rule j, and the value false (logical 0) if it does not. If rules contains only one control rule, R is a logical vector of length n.

Names of the applied control rules, returned as a cell array of character vectors. If rules includes "we" or "n", all of the associated rules are included in appliedRules.

Version History

Introduced in R2006b

See Also