qcc
object and
optional within group standard deviation or control limit specifications.
Rules may be applied to the chart and violating points highlighted.
shewhart(object, newdata)
shewhart(object, newdata, type, limits, target, std.dev, sizes, labels, label.limits = c("LCL","UCL"), confidence.level = 0.999, nsigmas, add.stats = T, chart.all = F, ylim.min = NULL, rules = shewhart.rules, highlight = list(pch = 1, col = 2), ...)
"qcc"
which provides information on the type of group
summary statistics to plot and the within group standard deviation necessary
for computing the control limits.
statistics
,
new.statistics
, or both in
object
are charted depending
on the argument
chart.all
.
"xbar"
,
"s"
,
"R"
,
"p"
,
"np"
,
"u"
, or
"c"
built-in functions will be used. (See
help(stats.xbar)
for more information on these functions.) If the name
of a function, it is used to compute the group summary statistics.
std.dev
component in
object
or the
std.dev
argument if it is given. If missing, the
limits
function
determined by
type
is used to compute the control limits. See DETAILS below.
center
component of
object
.
std.dev
component of
object
.
newdata
for xbar, s,
and R charts. For p, np, and u charts,
sizes
corresponds to the number of
units examined. For c charts, sizes is assumed to be 1.
sizes
may be used in conjunction with providing summary statistics
rather than the original new data to
newdata
and is necessary if type is
"p"
,
"np"
or
"u"
. If of length 1, its value is assumed to be the size of
all the groups.
newdata
. The default vector
of labels is the
"names"
attribute if
newdata
is a vector or list, the
first component of the
"dimnames"
attribute if
newdata
is a matrix, the
"row.names"
attribute if
newdata
is a data frame, or, if the appropriate
attribute is NULL, the first n integers where n is the number of groups.
c("LCL","UCL")
.
confidence.level
is used.
TRUE
. Set
add.stats = FALSE
if you want to
add your own text or lines to the chart.
statistics
component of
object
should be plotted along with the
new.statistics
component of
object
if
present and the summary statistics of
newdata
if given. The default of
FALSE
does not plot the
statistics
component of
object
.
shewhart.rules
.
See DETAILS below.
rules
. The default is
highlight = list(pch = 1, col = 2)
. If more than
one rule is applied to the chart, this can be a list of lists of plotting
parameters for highlighting successively the points violating each rule.
rules
.
"shewhart"
object, which inherits from
"qcc"
, with all
the components of
object
plus the following additional arguments:
newdata
with "names" attribute
equal to labels.
If this exists in
object
prior to calling
shewhart
and
newdata
is given,
the group summary statistics computed from
newdata
will be appended to the
new.statistics
component of
object
and the entire set of statistics
returned.
new.sizes
component of
object
exists prior to calling
shewhart
and
newdata
is given,
new.sizes
computed from
newdata
will be appended to the
new.sizes
component of
object
and the entire set of sizes returned.
target
argument if specified.
newdata
.
If this exists in
object
prior to calling
shewhart
and
newdata
is given,
an
"and"
and the name of the input data will be appended to the
newdata.name
component of
object
and the entire character string returned.
shewhart
can pass the return value of a call to
shewhart
, which includes
newdata
, in place of
object
with additional
data in the
newdata
argument.
The argument
object
provides the chart type (see
help(qcc)
for more details)
and an estimate for the within group standard deviation if
std.dev
is not
given as an argument. The control limits are computed and a Shewhart chart is
produced for three different sets of summary statistics depending on the
value of
chart.all
and whether
newdata
is given.
1) If
chart.all = F
and
newdata
is given, any summary statistics in the
new.statistics
component
of
object
and the summary statistics for
newdata
computed depending
upon
type
will be charted.
2) If
chart.all = F
and
newdata
is missing, only the statistics in the
new.statistics
component of
object
will be charted.
3) If
chart.all = T
,
the
statistics
component and the
new.statistics
component of
object
will
be charted along with the summary statistics of
newdata
if given.
If
limits
is missing,
shewhart
will use the
cntrl.limits
component
of
object
, if it exists, as the control limits for the chart. If
limits
is missing and there is not a
cntrl.limits
component of
object
, appropriate
default functions compute the control limits for the chart. The name of the
default function that computes the control limits is formed by pasting together
"limits"
, a period, and the value of
type
. Thus the
control limits of an xbar chart are computed by
.
By default, probability limits are computed with equal tail probabilities
computed as
(1 - confidence.level)/2
. The control limits are centered in
probability about
target
if it is given, the
target
component of
object
if present, or the
center
component of
object
, in that order or preference.
If
nsigmas
is given,
in the normal case
the control limits are computed as
target
(or
center
if
target
and
object$target
are missing) plus or minus
nsigmas
times the
standard errors of the group summary statistics.
In the binomial case a variance-stabilizing transformation is
performed first, limits are computed, and results translated back to
the original scale; see
.
If
length(unique(sizes)) > 1
,
the summary statistics' standard errors will be
different, and the control limits are computed as step functions.
For more details on how the control limits are computed for Shewhart
charts see the help file for the appropriate function (e.g.
for
the xbar chart).
If
limits
is given as a vector or matrix, the values specify the control
limits.
If
limits
is a function, then it must return a vector or matrix
specifying the control limits. If it returns a vector, the first element
is the lower control limit and the second element is the upper control
limit. If it returns a matrix, the first column corresponds to the lower control
limits and the second column corresponds to the upper control limits.
The
ylim.min
argument can be used to expand the range of the y-axis if
additional
detail needs to be added to the chart. For example, additional limits can be
added to a chart by setting
ylim.min
appropriately. If the additional limits
are in
addl.limits
, then setting
ylim.min = addl.limits
will guarantee that
the y-axis range is large enough for any subsequent calls to
abline
or
lines
. When low level plotting functions are used to add detail to a
Shewhart chart, you need to specify
add.stats = FALSE
in the call to
shewhart
or else the coordinates will be incorrect for adding detail.
The
rules
argument specifies a function to determine points which violate
a given (set of) rule(s). For example, the
beyond.limits
function returns
the indices of the charted statistics which are beyond the control limits. The
indicated points are highlighted according the plotting parameters specified
by
highlight
. Other rules functions which are provided are
runs.target
for
determining all points in a run, for a given run length, above or below the
target
value and
shewhart.rules
which combines
beyond.limits
and
runs.target
. Although
rules
can be used in this way to more quickly
detect small shifts (on the order of 0.5 - 1.5 standard errors) in the
process, cusum charts are preferable. See
help(cusum)
for more details.
std.dev
argument, or the
std.dev
component of
object
in that order of preference.
If
newdata
is given, the summary statistics for
newdata
along with
any summary statistics contained in the
new.statistics
component of
object
are charted. If
newdata
is missing, the
new.statistics
component of
object
is charted. If
chart.all = TRUE
the
statistics
component of
object
is included on the chart. Repeated calls to
shewhart
with the return
value of the previous call as
object
and a
newdata
argument each time
charts the summary statistics of the aggregate of the
newdata
arguments.
limits.ewma
,
limits.mR
,
limits.ma
, and
limits.ms
.
shewhart(qcc(matrix(rnorm(100), ncol = 5), type = "xbar"))