capability
R2026bCompute process capability indices
Syntax
Description
fits a normal distribution to the values in S = capability(X,specs)X and returns a structure
containing the fitted parameter values, estimated process probabilities, capability indices,
and confidence intervals for the capability indices, given the process specifications in
specs.
Before implementing a process in production, you can conduct a capability study to assess whether the process will consistently operate within the specified limits. For example, you can use capability indices to estimate the expected percentages of defective parts.
specifies options using one or more name-value arguments in addition to any of the input
argument combinations in the previous syntaxes. For example, you can specify the
significance level for the confidence intervals. (since R2026b)S = capability(___,Name=Value)
Examples
Simulate a sample of 100 measurements from a process. The measurements have a normal distribution with a mean of 3 and a standard deviation of 0.005.
X = normrnd(3,0.005,100,1);
Specify a lower specification limit of 2.99 and an upper specification limit of 3.01 for the process, and compute the capability indices and their confidence intervals.
S = capability(X,[2.99 3.01])
S = struct with fields:
P: 0.9129
Pl: 0.0339
Pu: 0.0532
Cp: 0.5735
CpCI: [2×1 double]
Cpl: 0.6088
CplCI: [2×1 double]
Cpu: 0.5382
CpuCI: [2×1 double]
Cpk: 0.5382
CpkCI: [2×1 double]
Distribution: 'Normal'
mu: 3.0006
sigma: 0.0058
Display the 95% confidence interval for the Cp capability index.
S.CpCI
ans = 2×1
0.4937
0.6532
Simulate a sample of 100 measurements from a beta distribution with the shape parameters a=1 and b=3.
x = betarnd(1,3,[100 1]);
Set a lower specification limit of 0.1 and an upper specification limit of 0.9 for the process. Use the capability function to fit a beta distribution to the sample data and return the capability indices and their confidence intervals.
specs = [0.1 0.9];
S = capability(x,specs,"Beta")S = struct with fields:
P: 0.7658
Pl: 0.2337
Pu: 4.5445e-04
Cp: 0.9281
CpCI: [2×1 double]
Cpl: 0.5441
CplCI: [2×1 double]
Cpu: 1.0571
CpuCI: [2×1 double]
Cpk: 0.5441
CpkCI: [2×1 double]
Distribution: 'Beta'
a: 1.1914
b: 3.4889
Display the 95% confidence interval for the Cp capability index.
S.CpCI
ans = 2×1
0.8731
1.0002
Simulate a sample of 100 measurements from a Rayleigh distribution with the scale parameter b=0.2.
x = raylrnd(0.2,[100 1]);
Fit a Rayleigh distribution to the sample data using the fitdist function.
pd = fitdist(x,"Rayleigh")pd =
RayleighDistribution
Rayleigh distribution
B = 0.217169 [0.197812, 0.240759]
pd is a RayleighDistribution object that contains the fit information and the input data x.
Set a lower specification limit of 0.1 and an upper specification limit of 0.5 for the process, and compute the capability indices and their confidence intervals.
S = capability(pd,[0.1 0.5])
S = struct with fields:
P: 0.8288
Pl: 0.1006
Pu: 0.0706
Cp: 0.5140
CpCI: [2×1 double]
Cpl: 0.6370
CplCI: [2×1 double]
Cpu: 0.4577
CpuCI: [2×1 double]
Cpk: 0.4577
CpkCI: [2×1 double]
Distribution: 'Rayleigh'
B: 0.2172
Display the 95% confidence interval for the Cp capability index.
S.CpCI
ans = 2×1
0.4539
0.5666
Input Arguments
Input data, specified as a numeric vector or matrix. If X is a
matrix, capability operates on each column of
X.
Data Types: single | double
Specification limits, specified as a numeric vector or matrix. If
X is a vector, specs is a two-element vector
that contains the lower and upper specification limits. At least one element must be
finite. If X is a matrix, specs is a two-row
matrix with the same number of columns as X.The first row contains
the lower specification limits, and the second row contains the upper specification
limits. If you specify specs as a two-element vector and
X is a matrix, the function replicates the values of
specs to match the size of X.
If there is no lower specification bound, specify the first element of
specs as –Inf. If there is no upper
specification bound, specify the second element of specs as
Inf.
Data Types: single | double
Since R2026b
Probability distribution name, specified as a character vector or string scalar
containing one of the following values. distname must be the name
of a continuous probability distribution supported by the fitdist function. The default value is "Normal".
You cannot specify distname when you specify
pd.
| Value | Description |
|---|---|
"Beta" | Beta distribution |
"BirnbaumSaunders" | Birnbaum–Saunders distribution |
"Burr" | Burr distribution |
"Exponential" | Exponential distribution |
"Extreme Value" or "ev" | Extreme Value distribution |
"Gamma" | Gamma distribution |
"Generalized Extreme Value" or
"gev" | Generalized Extreme Value distribution |
"Generalized Pareto" or
"gp" | Generalized Pareto distribution |
"Half Normal" or "hn" | Half-normal distribution |
"InverseGaussian" | Inverse Gaussian distribution |
"Kernel" | Kernel distribution |
"Logistic" | Logistic distribution |
"Loglogistic" | Loglogistic distribution |
"Lognormal" | Lognormal distribution |
"Nakagami" | Nakagami distribution |
"Normal" (default) | Normal distribution |
"Rayleigh" | Rayleigh distribution |
"Rician" | Rician distribution |
"Stable" | Stable distribution |
"tLocationScale" | t Location-Scale distribution |
"Weibull" or "wbl" | Weibull distribution |
Since R2026b
Probability distribution, specified as a continuous probability distribution object.
The table below lists the supported probability distributions. Note that the
capability function does not support discrete probability
distribution objects.
| Distribution Name | Description | Distribution Object |
|---|---|---|
"Beta" | Beta distribution | BetaDistribution |
"BirnbaumSaunders" | Birnbaum–Saunders distribution | BirnbaumSaundersDistribution |
"Burr" | Burr distribution | BurrDistribution |
"Exponential" | Exponential distribution | ExponentialDistribution |
"Extreme Value" or "ev" | Extreme Value distribution | ExtremeValueDistribution |
"Gamma" | Gamma distribution | GammaDistribution |
"Generalized Extreme Value" or
"gev" | Generalized Extreme Value distribution | GeneralizedExtremeValueDistribution |
"Generalized Pareto" or
"gp" | Generalized Pareto distribution | GeneralizedParetoDistribution |
"Half Normal" or "hn" | Half-normal distribution | HalfNormalDistribution |
"InverseGaussian" | Inverse Gaussian distribution | InverseGaussianDistribution |
"Kernel" | Kernel distribution | KernelDistribution |
"Logistic" | Logistic distribution | LogisticDistribution |
"Loglogistic" | Loglogistic distribution | LoglogisticDistribution |
"Lognormal" | Lognormal distribution | LognormalDistribution |
"Nakagami" | Nakagami distribution | NakagamiDistribution |
"Normal" (default) | Normal distribution | NormalDistribution |
"Rayleigh" | Rayleigh distribution | RayleighDistribution |
"Rician" | Rician distribution | RicianDistribution |
"Stable" | Stable distribution | StableDistribution |
"tLocationScale" | t Location-Scale distribution | tLocationScaleDistribution |
"Weibull" or "wbl" | Weibull distribution | WeibullDistribution |
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: capability(X,specs,Alpha=0.01) specifies to return 99%
confidence intervals for the capability indices.
Since R2026b
Significance level for the confidence intervals, specified as a scalar in the
range [0,1].
The default confidence level is 95% (α = 0.05).
Example: Alpha=0.01
Data Types: single | double
Since R2026b
Number of bootstrap iterations to use when computing capability index confidence
intervals, specified as a positive integer. The function ignores this argument when
distname is "Normal" (the default) or
pd is a NormalDistribution object and contains data.
Example: NumBootstrapSamples=50
Data Types: single | double
Output Arguments
Process statistics, returned as a structure. The structure includes the estimated
process probabilities, capability indices, and confidence intervals for the capability
indices. The structure also includes a field containing each fitted distribution
parameter value (or distribution parameter value in pd). For
example, if distname is "Weibull", the structure
includes the fields A and B.
The estimated process probabilities are shown below, where cdf is
the cumulative distribution function. The capability function
computes the cdf using the fit to the input data X (or the
distribution in pd).
| Field | Description | Formula |
|---|---|---|
Pl | Estimated probability of being below the lower specification limit
L | cdf(L) |
Pu | Estimated probability of being above the upper specification limit
U | 1–cdf(U) |
P | Estimated probability of being within the specification limits | 1–(Pl+Pu) |
Each capability index in S is the ratio of a specification
width (between specification limits) and a process width (between control limits). A
higher index value indicates a process with fewer measurements outside of the
specification limits. When distname is "Normal"
(or if pd is a NormalDistribution object and contains data), the
capability function uses the following formulas to compute the
capability indices. mu is the sample mean (stored in
S.mu), and sigma is the sample standard
deviation (stored in S.sigma).
| Field | Formula |
|---|---|
Cp | (U–L)/(6*sigma) |
Cpl | (mu–L)./(3*sigma) |
Cpu | (U–mu)./(3*sigma) |
Cpk | min(Cpl,Cpu) |
The capability function computes the following confidence
intervals for the capability indices using the formulas given by [1]. Each
value is a two-element column vector containing the lower confidence interval bound and
upper confidence interval bound.
| Field | Description |
|---|---|
CpCI | Confidence interval on Cp |
CplCI | Confidence interval on Cpl |
CpuCI | Confidence interval on Cpu |
CpkCI | Confidence interval on Cpk |
When distname is not "Normal" (or
pd is not a NormalDistribution object that
contains data), the function computes nonparametric estimates of the capability indices
using the following formulas, and computes the confidence intervals for the indices
using a bootstrap method with NumBootstrapSample
iterations. You can choose which set of formulas to use by specifying
IndexEstimationMethod as "percentile" (the
default) or "zscore".
| Capability Index | IndexEstimationMethod="percentile" (Default) | IndexEstimationMethod="zscore" |
|---|---|---|
Cp | (U–L)/(icdf(0.99865)–icdf(0.00135)) | (norminv(cdf(U))–norminv(cdf(L)))/6 |
Cpl | (median–L)./(median–icdf(0.00135)) | –norminv(cdf(L))/3 |
Cpu | (U–median)/(icdf(0.99865)–median) | norminv(cdf(U))/3 |
Cpk | min(Cpl,Cpu) | min(Cpl,Cpu) |
The functions in the previous table are defined below:
| Quantity | Description |
|---|---|
icdf(p) | Inverse cdf value of the probability distribution fit to
X (or the distribution in pd) at
p |
median | Median of the probability distribution fit to X (or
the distribution in pd) |
norminv(p) | Inverse of the cdf value of the standard normal at p |
References
[1] Montgomery, Douglas C. Statistical Quality Control. 7th ed. Nashville, TN: John Wiley & Sons, 2012.
Version History
Introduced in R2006bCompute capability indices and confidence intervals using a probability distribution
other than the normal distribution. Specify distname as
the name of a continuous probability distribution supported by the fitdist function. Alternatively, specify pd as a
continuous probability distribution object in the workspace. When you specify a nonuniform
probability distribution, you can use the IndexEstimationMethod name-value argument to choose the capability index
estimation method, either percentile or z-score.
The function returns confidence intervals for the capability indices in the output
structure S. Use the
Alpha name-value
argument to specify the significance level for the confidence intervals. If you specify a
nonuniform probability distribution, the function computes the confidence intervals using a
bootstrap method. Set the number of bootstrap iterations using the NumBootstrapSamples name-value argument.
See Also
capaplot | fitdist | makedist | histfit | Distribution Fitter
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)