qualityTools (version 1.55)

pcr: Process Capability Indices

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

pcr(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”
  • “gamma3”
  • “weibull3”
  • “lognormal3”
  • “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.
plot
logical value. If set to ‘FALSE’ the graphical output will be omitted.\ By default plot is set to ‘TRUE’.
bounds.col
graphical parameter. For further details see ppPlot or qqPlot.
bounds.lty
graphical parameter. For further details see ppPlot or qqPlot.
...
some other graphical parameters.

Value

The function pcr returns a list with lambda, cp, cpl, cpu, ppt, ppl, ppu, A, usl, lsl, target.

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).
  • pt stands for total fraction nonconforming
  • pu stands for upper fraction nonconforming
  • pl stands for lower fraction nonconforming
  • cp stands for process capability index
  • cpkL stands for lower process capability index
  • cpkU stands for upper process capability index
  • cpk stands for minimum process capability index

For a Box-Cox tranformation a data vector with positive values is needed to estimate an optimal value of lambda for the Box-Cox power transformation of teh values. The Box-Cox power transformation is used to bring the distribution of the data vector to a form close to normal. Estimation of the optimal lambda is deligated to the function boxcox of the MASS package. The Box-Cox transformation has the form y(lambda)=(y^lambda-1)/lambda for lambda not equal to zero, and y(lambda)=log(y) for lambda equal to zero. The function boxcox computes the profile log-likelihoods for a range of values of parameter lambda. Function boxcox.lamba returns the value of lambda with the maximum profile log-likelihood.

In case no specification limits are given, ‘lsl’ and ‘usl’ are calculated to support a process capability index of 1.

References

  • ISO(2006). Statistical methods - Process performance and capability statistics for measured quality characteristics (ISO 21747).
  • ISO/TR(2007).Statistical methods in process management - capability and performance - part 4: process capability estimates and performance (ISO/TR 22514-4).
  • MITTAG, H.-J.; RINNE, H.: Prozessfaehigkeitsmessung fuer die industrielle Praxis. Muinch: Hanser, 1999.
  • KOTZ, Samuel; LOVELACE, Cynthia R.: Process capability indices in theory and practice. London,New York: Arnold, 1998.
  • Process Capability Statistics for Non-Normal Distributions in R https://web.warwick.ac.uk/statsdept/user2011/TalkSlides/Contributed/18Aug_0950_FocusVI_5-ProcessOptimization_2-Roth.pdf

See Also

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

Examples

x = rweibull(30, 2, 8) +100
#process capability for a weibull distribution
pcr(x, "weibull", lsl = 100, usl = 117)

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

#boxcox with lambda=2
pcr(x, boxcox = 2, lsl = 1)

#process capability assuming a normal distribution
pcr(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
pcr(x, grouping = group) #compare to sd(x)