cp: Process Capability Indices

Description Usage Arguments Details Note Author(s) References See Also Examples

Description

Calculates the process capability cp, cpk, cpkL (onesided) and cpkU (onesided) for a given dataset and distribution.
A histogramm with a density curve is displayed along with the specification limits and a Quantile-Quantile Plot for the specified distribution.
Lower-, upper and total fraction of nonconforming entities are calculated. Box Cox Transformations are supported as well as the calculation of Anderson Darling Test Statistics.

Usage

1
2
3
4
5
6
cp(x, distribution = "normal", lsl, usl, target, boxcox = FALSE, 
    lambda = c(-5,5), main, xlim, ylim, grouping = NULL, std.dev = NULL,  
    conf.level = 0.9973002, start, lineWidth = 1, lineCol = "red", 
    lineType = "solid", specCol = "red3", specWidth = 1, cex.text = 2, 
    cex.val = 1.5, cex.col = "darkgray", plot = TRUE, bounds.lty = 3, 
    bounds.col = "red", ...)

Arguments

x

numeric vector containing the values for which the process capability should be calculated.

distribution

character string specifying the distribution of x. The function cp will accept the following caracter strings for distribution:

  • “normal”

  • “log-normal”

  • “exponential”

  • “logistic”

  • “gamma”

  • “weibull”

  • “cauchy”

  • “beta”

  • “f”

  • “t”

  • “geometric”

  • “poisson”

  • “negative-binomial”

By default distribution is set to “normal”.

lsl

numeric value for the lower specification limit.

usl

numeric value for the upper specification limit.

target

(optional) numeric value giving the target value.

boxcox

logical value specifying whether a Box-Cox transformation should be performed or not.
By default boxcox is set to ‘FALSE’.

lambda

(optional) lambda for the transformation, default is to have the function estimate lambda.

main

an overall title for the plot: see title.

xlim

vector giving the range of the x-axis.

ylim

vector giving the range of the y-axis.

grouping

(optional) If grouping is given the standard deviation is calculated as mean standard deviation of the specified subgroups corrected by the factor c4 and expected fraction of nonconforming is calculated using this standard deviation.

std.dev

(optional) historical standard devation (only provided for normal distribution!).

conf.level

numeric value between ‘0’ and ‘1’ giving the confidence interval.
By default conf.level is 0.9973 (99.73%) which is the reference interval bounded by the 99.865% and 0.135% quantile.

start

a named list giving the parameters to be fitted with initial values. Must be supplied for some distribution (see fitdistr of the R-package MASS).

lineWidth

a numeric value specifying the width of the line for the density curve.

lineCol

numerical value or character string (like “red”) specifying the color of the line for the density curve.

lineType

character string specifying the line type e.g. “dashed”, “solid”, etc.

specCol

numerical value or character string specifying the color for the specification limits.

specWidth

numerical value specifying the line width for the specification limits.

cex.text

numerical value specifying the cex for lsl, usl and target.

cex.val

numerical value specifying the cex for the process capability ratios.

cex.col

numerical value or character string specifying the color for lsl, usl and target.

bounds.col

graphical parameter. For further details see ppPlot or qqPlot.

bounds.lty

graphical parameter. For further details see ppPlot or qqPlot.

plot

logical value. If set to ‘FALSE’ the graphical output will be omitted.\ By default plot is set to ‘TRUE’.

...

some other graphical parameters.

Details

Distribution fitting is deligated to function fitdistr of the R-package MASS as well as the calculation of lambda for the Box Cox Transformation. p-values for Anderson Darling Test are reported for the most important distributions.
cpk is always min(cpK, cpL).

Note

At this point there's no distinction made between process performance P_pk and process capability.
The latter implies a process that is in statistical contro whereas process performance is estimated for a process that might not have been demonstrated to be in a state of statistical control.
For a detailed example which shows the usage of the function cp() please read the vignette for the package qualityTools at http://www.r-qualitytools.org/html/Analyze.html.

Author(s)

Thomas Roth thomas.roth@tu-berlin.de

References

See Also

qqPlot
ppPlot
http://www.r-qualitytools.org/html/Analyze.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
x = rweibull(30, 2, 8) +100
#process capability for a weibull distribution
cp(x, "weibull", lsl = 100, usl = 117)

#box cox transformation and one sided
cp(x, boxcox = TRUE, lsl = 1)

#process capability assuming a normal distribution
cp(x, "normal", lsl = 0, usl = 17)

#process capability for a normal distribution and data in subgroups
#some artificial data with shifted means in subgroups
x = c(rnorm(5, mean = 1), rnorm(5, mean = 2), rnorm(5, mean = 0))

#grouping vector
group = c(rep(1,5), rep(2,5), rep(3,5))
                                                                    
#calculate process capability
cp(x, grouping = group) #compare to sd(x)

qualityTools documentation built on May 2, 2019, 10:21 a.m.