# gagerr

Gage repeatability and reproducibility study

## Syntax

## Description

`gagerr(___,`

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 whether to display a bar
graph of results, and set the specification limits for the precision-to-tolerance ratio
(PTR) calculation.`Name=Value`

)

additionally
returns the numeric matrix `results`

= gagerr(___)`results`

, which contains the study
results.

## Examples

### Gage Repeatability and Reproducibility Study

Simulate a measurement data set by randomly generating 100 measurements `y`

of three parts. Each measurement is collected by one of four randomly assigned operators.

rng(1234,"twister"); % For reproducibility n = 100; y = randn(n,1); part = randi([1,3],1,n); operator = randi([1,4],1,n);

Perform a Gage repeatability and reproducibility (R&R) study on this data set using a mixed ANOVA model without interactions.

gagerr(y,{part,operator},RandomOperator=false)

{'Source' } {'Variance'} {'% Variance'} {'sigma' } {'5.15*sigma'} {'% 5.15*sigma'} {'Gage R&R' } {[ 0.9535]} {[ 99.2515]} {[0.9765]} {[ 5.0288]} {[ 99.6250]} {' Repeatability' } {[ 0.9535]} {[ 99.2515]} {[0.9765]} {[ 5.0288]} {[ 99.6250]} {' Reproducibility'} {[ 0]} {[ 0]} {[ 0]} {[ 0]} {[ 0]} {'Part' } {[ 0.0072]} {[ 0.7485]} {[0.0848]} {[ 0.4367]} {[ 8.6518]} {'Total' } {[ 0.9607]} {[ 100]} {[0.9801]} {[ 5.0477]} {0x0 char } Number of distinct categories (NDC):0 % of Gage R&R of total variations (PRR): 99.63 Note: The last column of the above table does not have to sum to 100%

The software displays information and a bar graph summarizing the study results. Each row of the table contains statistics for a different source of variability in the measurement data. In this data set, the dominant source of variability is repeatability (the variation in the measurement value on the same part, obtained by the same operator). This source is responsible for 99.25% of the total measurement variance, and 99.63% of the total measurement standard deviation. The number of distinct categories is 0, indicating that the measurement system is not capable of distinguishing any groups within the measurement data.

## Input Arguments

`y`

— Measurements

numeric column vector

Measurements, specified as a numeric column vector.

**Data Types: **`single`

| `double`

`part`

— Parts

categorical array | character array | string array | logical column vector | numeric column vector | cell array of character vectors

Parts, specified as a categorical, character, or string array, a logical or numeric
column vector, or a cell array of character vectors. `part`

must have
the same size as `y`

. Each element of `part`

contains an identifier for the part associated with the corresponding measurement in
`y`

.

**Data Types: **`categorical`

| `char`

| `string`

| `logical`

| `single`

| `double`

| `cell`

`operator`

— Operators

categorical array | character array | string array | logical column vector | numeric column vector | cell array of character vectors

Operators, specified as a categorical, character, or string array, a logical or
numeric column vector, or a cell array of character vectors.
`operator`

must have the same size as `y`

. Each
element of `operator`

contains an identifier for the operator that
collects the corresponding measurement in `y`

.

**Data Types: **`categorical`

| `char`

| `string`

| `logical`

| `single`

| `double`

| `cell`

`group`

— Parts and operators

`n`

-by-2 numeric matrix

Parts and operators, specified as an `n`

-by-2 numeric matrix, where
`n`

is the length of `y`

. The first and second
columns of `group`

contain numeric identifiers for the part and
operator, respectively, corresponding to the measurements in
`y`

.

**Data Types: **`single`

| `double`

`ax`

— Target axes

`Axes`

object

Axes for the plot, specified as an `Axes`

object. If you do not
specify `ax`

, then `gagerr`

creates the plot
using the current axes. For more information on creating an `Axes`

object, see `axes`

.

### 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: **`results=gagerr(y,group,PrintTable="off")`

specifies to
suppress the display of command-line output.

*
Before R2021a, use commas to separate each name and value, and enclose*
`Name`

*in quotes.*

`Model`

— ANOVA model type

"linear" (default) | "interaction" | "nested"

ANOVA model type, specified as one of the values in this table.

Value | Description |
---|---|

`"linear"` (default) | Main effects only |

`"interaction"` | Main effects plus two-factor interactions between
`operator` and `part` |

`"nested"` | `operator` is nested in `part` .
Use this model when operators are assigned to specific parts, and the
operators measure only those specific parts. For more information, see Other ANOVA Models. |

If you specify `"linear"`

or
`"interaction"`

, `gagerr`

calls the `anovan`

function with the specified value of `Model`

.
If you specify `"nested"`

, `gagerr`

calls
`anovan`

with `model`

`="linear"`

and `nested`

```
=[0 0; 1
0]
```

.

If you specify `part`

but do not specify
`operator`

in the call to `gagerr`

, you cannot
specify `"interaction"`

or `"nested"`

.

**Example: **`Model="interaction"`

**Data Types: **`char`

| `string`

`RandomOperator`

— Indicator for random operators

`true`

or `1`

(default) | `false`

or `0`

`Spec`

— Lower and upper specification limits

`[]`

(default) | two-element numeric vector

Lower and upper specification limits, specified as a two-element numeric vector.
If you specify `Spec`

, the software computes the
precision-to-tolerance ratio (PTR) using the formula $$\text{PTR}=5.15\text{\hspace{0.17em}}{\sigma}_{\text{GRR}}/|({\text{S}}_{2}-{\text{S}}_{1})|$$, where σ_{GRR} is the Gage R&R standard
deviation, and S_{1} and S_{2} are the first
and second elements of `Spec`

, respectively. If you do not specify
`Spec`

, PTR is `NaN`

. For more information about
PTR, see Gage R&R
Study.

**Example: **`Spec=[0.1 0.9]`

**Data Types: **`single`

| `double`

`PrintTable`

— Flag to display results output

"on" (default) | "off"

Flag to display the results output, specified as `"on"`

or
`"off"`

. For more information about the results output, see Gage R&R
Study.

**Example: **`PrintTable="off"`

**Data Types: **`char`

| `string`

`PrintGraph`

— Flag to display bar graph of results

"on" (default) | "off"

Flag to display a bar graph of the results, specified as `"on"`

or `"off"`

. For more information about the bar graph results, see
Gage R&R
Study.

**Example: **`PrintGraph="off"`

**Data Types: **`char`

| `string`

## Output Arguments

`results`

— Study results

6-by-5 numeric matrix

Study results, returned as a 6-by-5 numeric matrix where the rows contain metrics
for individual sources of variability in the measurement system. The rows of
`results`

are described below.

Row | Description |
---|---|

Gage R&R | Total measurement variation due to repeatability and reproducibility sources |

Repeatability | Variation in the measurements of the same part, collected by the same operator |

Reproducibility | Variation in the measurements of the same part, collected by different operators |

Operator | Variation in the measurements collected by the same operator |

Part*Operator | Variation in the measurements due to the two-factor interactions of parts
and operators. The variation is zero unless `Model` is
`"interaction"` . |

Part-to-part | Variation among the set of parts |

The columns of `results`

are described
below.

Column | Description |
---|---|

Source | Variability source |

Variance | Variance |

% Variance | Percentage of the total variance |

sigma | Standard deviation (square root of the variance) |

5.15*sigma | Study variance, which is 5.15 times the standard deviation |

% 5.15*sigma | Percentage of the total study variance |

`stats`

— Summary statistics

structure

Summary statistics, returned as a structure with these fields:

`ndc`

— Number of distinct categories`prr`

— Percentage of Gage R&R of total variations`ptr`

— Precision-to-tolerance ratio

If you do not specify `Spec`

, then
`ptr`

is `NaN`

. For more information on the summary
statistics, see Gage R&R
Study.

## More About

### Gage R&R Study

A Gage repeatability and reproducibility (R&R) study uses one- or two-way analysis
of variance (see `anovan`

) to assess the precision of a measurement
system. In a typical system, a group of operators use gages to obtain multiple measurements
of a set of items (parts) under the same conditions, if possible. If a system has high
precision, the measurements of an individual part are narrowly scattered around a single
value. There are several possible sources of variability in a measurement system.

Variability Source | Description |
---|---|

Repeatability | Variation in the measurements of the same part, collected by the same operator |

Operator | Variation in the measurements collected by the same operator |

Part*Operator | Variation in the measurements due to the interactions of parts and operators |

Reproducibility | Sum of Operator and Part*Operator |

Gage R&R | Total measurement variation due to repeatability and reproducibility |

Part-to-part | Variation among the set of parts. |

The total variability in a measurement system is the sum of Gage R&R variability and part-to-part variability.

Each of the variability sources can be characterized by a statistical metric. Common
metrics are the variance, standard deviation (square root of the variance), percentage of
the total variance, and percentage of the total standard deviation. The *study
variance* is a measure of all variability in the measurement system due to
repeatability and reproducibility, and is defined as 5.15 times the Gage R&R standard
deviation. The factor 5.15 corresponds to the number of standard deviations that span the
middle 99% of a normally distributed population.

Three common summary metrics describe the capability of a measurement system to distinguish the parts from each other, based on the measurement data:

The

*number of distinct categories*(NDC) is a measure of how many groups the system can distinguish within the measurement data. NDC is equal to $$\sqrt{2}$$ times the ratio of part-to-part standard deviation to Gage R&R standard deviation. An NDC value of 5 or larger is indicative of a capable measurement system. A system with an NDC value smaller than 2 is not capable. For example, if a measurement system has NDC=3, the measurements can be divided into three groups, such as low, middle, and high.The

*percentage of Gage R&R of total variations*(PRR) is the fraction of the total standard deviation that is due to Gage R&R variability. In general, a system with PRR less than 10% is capable, while a PRR value greater than 30% indicates that the system is not capable.The

*precision-to-tolerance ratio*(PTR) compares the variability in the measurement system to the specified tolerance (`Spec`

). In general, a system with PTR less than 0.1 is capable, while a PTR value greater than 0.3 indicates that the system is not capable. For example, if the lower and upper specification limits for the set of parts are 1 and 20, respectively, and the standard deviation of the measurements due to Gage R&R is 0.3, the PTR value is 0.08, indicating a capable system.

## References

[1] Burdick, Richard K., Connie M. Borror, and Douglas C. Montgomery. *Design and Analysis of Gauge R&R Studies: Making Decisions with Confidence Intervals in Random and Mixed ANOVA Models*. ASA-SIAM Series on Statistics and Applied Probability. Philadelphia, Pa. : Alexandria, Va: Society for Industrial Applied Mathematics ; American Statistical Association, 2005.

## Version History

**Introduced in R2006b**

### R2024a: Specify target axes

Specify the target axes for the plot by using the `ax`

input
argument.

## Comando de MATLAB

Ha hecho clic en un enlace que corresponde a este comando de MATLAB:

Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- 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)