Skip to content

Can you trust the gauge?

Run a gauge R&R study to split measured variation into the parts, the instrument and the people, before you trust any chart built on it.

Applied ~10 min8 steps

What runs in CodeSplash

You will be able to

  • Separate repeatability, reproducibility and part-to-part variation
  • Read % study variation, % contribution and distinct categories
  • Spot an operator × part interaction and say what to do about it

Read first

01

What you measure isn't what's there

Read

Every chart in this unit sees the part plus the measurement error. If the gauge is noisy, it can blur a real signal, or make a good process look incapable.

A gauge R&RGauge R&RHow much of the measured variation comes from the measurement system instead of the parts. study separates three sources:

  • Repeatability: one person, one part, measured repeatedly. The gauge.
  • Reproducibility: differences between operators.
  • Part-to-part: the real differences you want to see.

Here, 3 operators measured 10 parts, 3 times each.

02

How much is the gauge?

Predict

Predict first

What share of the total variance comes from the measurement system?

About 3% of the varianceAbout 18% of the varianceAbout 50% of the variance
Reveal

3.2% of the variance. In the same study, the gauge accounts for 17.9% of the study variation. Same data, two scales. The next step shows why they differ.

03

Two scales

Checkpoint

% contribution compares variances, and % study variation compares standard deviations. The guidelines use the second: under 10% is good, 10–30% marginal, over 30% unacceptable.

Check yourself

The gauge's share of variance is 0.0322. What is its share of the study variation, as a proportion? Give three decimals.

Show the answer

Answer: 0.179416586304014

√0.0322 = 0.179. Square roots make small variance shares look much larger, which is why a study can sound fine on one scale and only marginal on the other.

04

Read the study

In the app
Gauge R&R study (crossed ANOVA method)Recorded · Python and R agreeRecorded 2026-11-17 · 15 values compared
R

Gauge R&R = 17.9% of study variation (marginal); 7 distinct categories (10 parts × 3 operators × 3 repeats).

% study var (R&R)
17.942
% contribution (R&R)
3.219
Distinct categories
7

Plots

Components of variationHow much of the observed variation comes from the measurement system rather than the parts?
View data
MeasureSourcePercent
contributionTotal gauge R&R3.219
contributionRepeatability1.576
contributionReproducibility1.643
contributionPart-to-part96.781
study_varTotal gauge R&R17.942
study_varRepeatability12.552
study_varReproducibility12.820
study_varPart-to-part98.377
toleranceTotal gauge R&R12.634
toleranceRepeatability8.839
toleranceReproducibility9.027
tolerancePart-to-part69.275
Measurement (mm) by part and operatorDoes the effect of one factor depend on another?
View data
OperatorPartMeasurement (mm)
AnaP0125.368
AnaP0125.402
AnaP0125.357
BenP0125.212
BenP0125.184
BenP0125.134
CleoP0125.129
CleoP0125.115
CleoP0125.180
AnaP0224.474
AnaP0224.653
AnaP0224.473
BenP0224.327
BenP0224.651
BenP0224.713
CleoP0224.291
CleoP0224.325
CleoP0224.426
AnaP0326.186
AnaP0326.184
AnaP0326.022
BenP0326.224
BenP0326.180
BenP0326.229
CleoP0326.186
CleoP0325.833
CleoP0325.850
AnaP0427.057
AnaP0427.307
AnaP0427.071
BenP0427.431
BenP0427.292
BenP0427.328
CleoP0427.148
CleoP0427.025
CleoP0427.076
AnaP0526.389
AnaP0525.945
AnaP0526.070
BenP0526.230
BenP0526.289
BenP0526.363
CleoP0526.306
CleoP0526.124
CleoP0526.132
AnaP0626.083
AnaP0626.263
AnaP0626.259
BenP0626.516
BenP0626.436
BenP0626.639
CleoP0626.432
CleoP0626.368
CleoP0626.285
AnaP0724.581
AnaP0724.599
AnaP0724.794
BenP0724.950
BenP0724.914
BenP0724.893

First 60 of 90 rows.

Two-way ANOVA with interaction

SourcedfSSMSFp
Part969.3337.704305.26< .001
Operator20.69280.346413.725< .001
Part × Operator180.45430.02521.817.044
Repeatability600.83340.0139——
Total8971.314———

Variance components

SourceVariance% contributionSDStudy var (6σ)% study var% tolerance
Total gauge R&R0.02843.2190.16851.01117.94212.634
Repeatability0.01391.5760.11790.707112.5528.839
Reproducibility0.01451.6430.12040.722212.8209.027
Operator0.01071.2140.10350.620811.0207.760
Operator × Part0.00380.42910.06150.36906.5504.613
Part-to-part0.853296.7810.92375.54298.37769.275
Total variation0.88151000.93895.63310070.418
  • Interaction kept (p = 0.044, pooling threshold 0.25).
  • ndc = ⌊√2 · σ_part / σ_R&R⌋.
The exact R script · R R version 4.5.1 (2025-06-13)
# Gauge R&R study (crossed ANOVA method)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method spc.gage_rr 1.0.1 · spec f59485008b899ddd
# Dataset: q1_gauge (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
library(codesplashr) # cs_spc_gage_rr(): twin of codesplash.quality.gage (AIAG / Minitab ANOVA method)

# Classic equivalent: SixSigma::ss.rr(var = y, part = part, appr = operator, data = df) or
# qualityTools::gageRR(); anova(lm(y ~ part * operator)) gives the same sums of squares.

# %% Data
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/q1_gauge.parquet", col_select = c("Measurement (mm)", "Part", "Operator")))
n_input <- nrow(df)
df[["Part"]] <- factor(df[["Part"]], levels = c("P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10"))  # stored level order
df[["Operator"]] <- factor(df[["Operator"]], levels = c("Ana", "Ben", "Cleo"))  # stored level order
df <- df[stats::complete.cases(df[c("Measurement (mm)", "Part", "Operator")]), , drop = FALSE]  # listwise deletion
df[] <- lapply(df, function(x) if (is.factor(x)) droplevels(x) else x)
n_dropped <- n_input - nrow(df)
warnings <- list()
if (n_dropped > 0) {
  warnings <- c(warnings, cs_warning("CS_W_ROWS_DROPPED", dropped = n_dropped, total = n_input))
}
if (n_input > 0 && nrow(df) == 0) cs_error("CS_E_NO_ROWS")
cs_check_finite_columns(df, c("Measurement (mm)", "Part", "Operator"))  # infinite values stop the run (registry/errors.yaml)

# %% Study
y_name <- "Measurement (mm)"
y <- as.numeric(df[[y_name]])
part <- as.character(df[["Part"]])
operator <- as.character(df[["Operator"]])
# The crossed study needs two parts, two operators and two repeats (8 rows) and measurements that vary
# (registry/errors.yaml; the same checks in Python).
cs_check_rows(length(y), 8, "A gauge R&R study")
cs_check_groups(part, "Part", minimum = 2)
cs_check_groups(operator, "Operator", minimum = 2)
cs_check_not_constant(y, y_name)
res <- cs_spc_gage_rr(y, part, operator, alpha_int = 0.25, k = 6,
                      tolerance = 8)
comp <- setNames(res$components, vapply(res$components, `[[`, "", "source"))
has_tol <- !is.null(res$tolerance)

# %% Tables and charts
tables <- list(
  list(key = "anova", title = paste0("Two-way ANOVA", if (res$pooled) " (interaction pooled into repeatability)" else " with interaction"),
       columns = list(list(key = "source", label = "Source", type = "string"), list(key = "df", label = "df", type = "integer"),
                      list(key = "ss", label = "SS", type = "number"), list(key = "ms", label = "MS", type = "number"),
                      list(key = "f", label = "F", type = "number"), list(key = "p", label = "p", type = "pvalue")),
       rows = res$anova),
  list(key = "components", title = "Variance components",
       columns = c(list(list(key = "source", label = "Source", type = "string"), list(key = "var", label = "Variance", type = "number"),
                        list(key = "pct_contribution", label = "% contribution", type = "number"), list(key = "sd", label = "SD", type = "number"),
                        list(key = "study_var", label = sprintf("Study var (%sσ)", format(res$k)), type = "number"),
                        list(key = "pct_study", label = "% study var", type = "number")),
                   if (has_tol) list(list(key = "pct_tolerance", label = "% tolerance", type = "number"))),
       rows = res$components))
show <- c("Total gauge R&R", "Repeatability", "Reproducibility", "Part-to-part")
measures <- c(contribution = "pct_contribution", study_var = "pct_study")
if (has_tol) measures <- c(measures, tolerance = "pct_tolerance")
g <- do.call(rbind, lapply(names(measures), function(mn) data.frame(source = show, value = vapply(show, function(s) comp[[s]][[measures[[mn]]]], 0),
                                                                   measure = mn, stringsAsFactors = FALSE)))
charts <- list(
  cs_chart("components", "gage-components", "Components of variation",
           list(source = cs_col("Source", g$source, "categorical"), value = cs_col("Percent", unname(g$value)),
                measure = cs_col("Measure", g$measure, "categorical"))),
  cs_chart("by-part", "interaction", sprintf("%s by part and operator", y_name),
           list(y = cs_col(y_name, y), x = cs_col("Part", part, "categorical"), trace = cs_col("Operator", operator, "categorical"))))

# %% Result
ord <- c("Total gauge R&R", "Repeatability", "Reproducibility", "Operator", "Operator × Part", "Part-to-part", "Total variation")
grr <- comp[["Total gauge R&R"]]
values <- list(
  parts = res$parts, operators = res$operators, replicates = res$replicates, pooled = res$pooled,
  p_interaction = res$p_interaction, ndc = res$ndc,
  var_components = I(vapply(ord, function(s) comp[[s]]$var, 0, USE.NAMES = FALSE)),
  pct_contribution = I(vapply(ord, function(s) comp[[s]]$pct_contribution, 0, USE.NAMES = FALSE)),
  pct_study = I(vapply(ord, function(s) comp[[s]]$pct_study, 0, USE.NAMES = FALSE)),
  pct_tolerance = if (has_tol) I(vapply(ord, function(s) comp[[s]]$pct_tolerance, 0, USE.NAMES = FALSE)) else NULL,
  anova_ss = I(vapply(res$anova, `[[`, 0, "ss")), anova_df = I(vapply(res$anova, `[[`, 0, "df")),
  pct_study_grr = grr$pct_study, pct_study_grr_frac = grr$pct_study / 100, pct_contribution_grr_frac = grr$pct_contribution / 100
)
verdict <- if (grr$pct_study < 10) "acceptable" else if (grr$pct_study <= 30) "marginal" else "not acceptable"
summary <- sprintf("Gauge R&R = %.1f%% of study variation (%s); %d distinct categories (%d parts × %d operators × %d repeats).",
                   grr$pct_study, verdict, res$ndc, res$parts, res$operators, res$replicates)
if (res$ndc < 5) warnings <- c(warnings, "Fewer than 5 distinct categories: the gauge cannot separate parts well enough for process control (AIAG).")
cs_publish(list(
  method = "spc.gage_rr",
  methodVersion = "1.0.1",
  title = "Gauge R&R study (crossed ANOVA method)",
  engine = cs_engine_info("stats", "codesplashr"),
  n = length(y),
  summary = summary,
  statistics = list(list(key = "pct_study_grr", label = "% study var (R&R)", value = grr$pct_study),
                    list(key = "pct_contribution_grr", label = "% contribution (R&R)", value = grr$pct_contribution),
                    list(key = "ndc", label = "Distinct categories", value = res$ndc, format = "integer")),
  tables = tables,
  charts = charts,
  warnings = warnings,
  notes = list(sprintf("Interaction %s (p = %s, pooling threshold %s).", if (res$pooled) "pooled" else "kept", format(signif(res$p_interaction, 3)),
                       format(0.25)), "ndc = ⌊√2 · σ_part / σ_R&R⌋."),
  values = values
))
Python

Gauge R&R = 17.9% of study variation (marginal); 7 distinct categories (10 parts × 3 operators × 3 repeats).

% study var (R&R)
17.942
% contribution (R&R)
3.219
Distinct categories
7

To keep this page light, the plots are shown once, under the R tab.

Two-way ANOVA with interaction

SourcedfSSMSFp
Part969.3337.704305.26< .001
Operator20.69280.346413.725< .001
Part × Operator180.45430.02521.817.044
Repeatability600.83340.0139——
Total8971.314———

Variance components

SourceVariance% contributionSDStudy var (6σ)% study var% tolerance
Total gauge R&R0.02843.2190.16851.01117.94212.634
Repeatability0.01391.5760.11790.707112.5528.839
Reproducibility0.01451.6430.12040.722212.8209.027
Operator0.01071.2140.10350.620811.0207.760
Operator × Part0.00380.42910.06150.36906.5504.613
Part-to-part0.853296.7810.92375.54298.37769.275
Total variation0.88151000.93895.63310070.418
  • Interaction kept (p = 0.044, pooling threshold 0.25).
  • ndc = ⌊√2 · σ_part / σ_R&R⌋.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# Gauge R&R study (crossed ANOVA method)
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method spc.gage_rr 1.0.1 · spec f59485008b899ddd
# Dataset: q1_gauge (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.

# %% Setup
import numpy as np
import pandas as pd

import codesplash as cs
from codesplash.errors import check_groups, check_not_constant
from codesplash.quality import gage  # twin of codesplashr::cs_spc_gage_rr (AIAG / Minitab ANOVA method)

# Classic equivalent in R: SixSigma::ss.rr(), qualityTools::gageRR(); in Python statsmodels' anova_lm on
# measurement ~ C(part) * C(operator) gives the same sums of squares.

# %% Data
df = pd.read_parquet("tests/parity/fixtures/q1_gauge.parquet", columns=["Measurement (mm)", "Part", "Operator"])
n_input = len(df)
df["Part"] = pd.Categorical(df["Part"], categories=["P01", "P02", "P03", "P04", "P05", "P06", "P07", "P08", "P09", "P10"])  # stored level order
df["Operator"] = pd.Categorical(df["Operator"], categories=["Ana", "Ben", "Cleo"])  # stored level order
df = df.dropna(subset=["Measurement (mm)", "Part", "Operator"])  # listwise deletion over the analysis columns
df["Part"] = df["Part"].cat.remove_unused_categories()
df["Operator"] = df["Operator"].cat.remove_unused_categories()
n_dropped = n_input - len(df)
warnings = []
if n_dropped:
    warnings.append(cs.cs_warning("CS_W_ROWS_DROPPED", dropped=n_dropped, total=n_input))
if n_input and not len(df):
    cs.cs_error("CS_E_NO_ROWS")
cs.check_finite_columns(df, ["Measurement (mm)", "Part", "Operator"])  # infinite values stop the run (registry/errors.yaml)

# %% Study
y_name = "Measurement (mm)"
y = df["Measurement (mm)"].to_numpy(dtype=float)
part = df["Part"].astype(str).tolist()
operator = df["Operator"].astype(str).tolist()
# The crossed study needs two parts, two operators and two repeats (8 rows) and measurements that vary
# (registry/errors.yaml; the same checks in R).
cs.check_rows(len(y), 8, "A gauge R&R study")
check_groups(part, "Part", minimum=2)
check_groups(operator, "Operator", minimum=2)
check_not_constant(y, y_name)
res = gage.gage_rr(y, part, operator, alpha_int=0.25, k=6, tolerance=8)
comp = {c["source"]: c for c in res["components"]}

# %% Tables and charts
tables = [{
    "key": "anova", "title": "Two-way ANOVA" + (" (interaction pooled into repeatability)" if res["pooled"] else " with interaction"),
    "columns": [{"key": "source", "label": "Source", "type": "string"}, {"key": "df", "label": "df", "type": "integer"},
                {"key": "ss", "label": "SS", "type": "number"}, {"key": "ms", "label": "MS", "type": "number"},
                {"key": "f", "label": "F", "type": "number"}, {"key": "p", "label": "p", "type": "pvalue"}],
    "rows": [{"source": s, "df": d_, "ss": ss, "ms": ms, "f": f, "p": p} for s, d_, ss, ms, f, p in res["anova"]],
}, {
    "key": "components", "title": "Variance components",
    "columns": [{"key": "source", "label": "Source", "type": "string"}, {"key": "var", "label": "Variance", "type": "number"},
                {"key": "pct_contribution", "label": "% contribution", "type": "number"}, {"key": "sd", "label": "SD", "type": "number"},
                {"key": "study_var", "label": f"Study var ({res['k']:g}σ)", "type": "number"},
                {"key": "pct_study", "label": "% study var", "type": "number"}]
    + ([{"key": "pct_tolerance", "label": "% tolerance", "type": "number"}] if res["tolerance"] else []),
    "rows": res["components"],
}]
show = ["Total gauge R&R", "Repeatability", "Reproducibility", "Part-to-part"]
g_source, g_value, g_measure = [], [], []
for measure, key in (("contribution", "pct_contribution"), ("study_var", "pct_study")) + ((("tolerance", "pct_tolerance"),) if res["tolerance"] else ()):
    for s in show:
        g_source.append(s)
        g_value.append(comp[s][key])
        g_measure.append(measure)
charts = [cs.chart(
    "components", "gage-components", "Components of variation",
    {"source": cs.col("Source", g_source, "categorical"), "value": cs.col("Percent", g_value),
     "measure": cs.col("Measure", g_measure, "categorical")},
), cs.chart(
    "by-part", "interaction", f"{y_name} by part and operator",
    {"y": cs.col(y_name, y.tolist()), "x": cs.col("Part", part, "categorical"), "trace": cs.col("Operator", operator, "categorical")},
)]

# %% Result
order = ["Total gauge R&R", "Repeatability", "Reproducibility", "Operator", "Operator × Part", "Part-to-part", "Total variation"]
grr = comp["Total gauge R&R"]
values = {
    "parts": res["parts"], "operators": res["operators"], "replicates": res["replicates"], "pooled": res["pooled"],
    "p_interaction": res["p_interaction"], "ndc": res["ndc"],
    "var_components": [comp[s]["var"] for s in order], "pct_contribution": [comp[s]["pct_contribution"] for s in order],
    "pct_study": [comp[s]["pct_study"] for s in order], "pct_tolerance": [comp[s]["pct_tolerance"] for s in order] if res["tolerance"] else None,
    "anova_ss": [r[2] for r in res["anova"]], "anova_df": [r[1] for r in res["anova"]],
    "pct_study_grr": grr["pct_study"], "pct_study_grr_frac": grr["pct_study"] / 100, "pct_contribution_grr_frac": grr["pct_contribution"] / 100,
}
verdict = "acceptable" if grr["pct_study"] < 10 else ("marginal" if grr["pct_study"] <= 30 else "not acceptable")
summary = (f"Gauge R&R = {grr['pct_study']:.1f}% of study variation ({verdict}); {res['ndc']} distinct categories "
           f"({res['parts']} parts × {res['operators']} operators × {res['replicates']} repeats).")
warnings = list(warnings)
if res["ndc"] < 5:
    warnings.append("Fewer than 5 distinct categories: the gauge cannot separate parts well enough for process control (AIAG).")
cs.publish({
    "title": "Gauge R&R study (crossed ANOVA method)",
    "engine": cs.engine_info("numpy", "scipy"),
    "n": len(y),
    "summary": summary,
    "statistics": [
        {"key": "pct_study_grr", "label": "% study var (R&R)", "value": grr["pct_study"]},
        {"key": "pct_contribution_grr", "label": "% contribution (R&R)", "value": grr["pct_contribution"]},
        {"key": "ndc", "label": "Distinct categories", "value": res["ndc"], "format": "integer"},
    ],
    "tables": tables,
    "charts": charts,
    "warnings": warnings,
    "notes": [f"Interaction {'pooled' if res['pooled'] else 'kept'} (p = {res['p_interaction']:.3g}, pooling threshold 0.25).",
              "ndc = ⌊√2 · σ_part / σ_R&R⌋."],
    "values": values,
})

By the guideline, this gauge is marginal, at 17.9% of study variation.

The number of distinct categories is 7: how many groups of parts the gauge can reliably tell apart. Common guidance asks for at least 5. Below that, the gauge can't support a variables chart.

With a tolerance, the card also shows % tolerance. That's a different question: can the gauge judge parts against the specification?

05

Do operators agree?

Predict

Predict first

The operator × part interaction has p = .044. What does an interaction mean here?

One operator is always highOperators disagree more on some parts than othersThe gauge has drifted
Reveal

Operators disagree more on some parts than others. Perhaps one part is hard to seat in the fixture, or a procedure is ambiguous. A constant offset between operators is a main effect instead. Below the pooling threshold, the study keeps the interaction as part of reproducibility.

06

Check your understanding

Checkpoint

Check yourself

Repeatability is large, and reproducibility is small. Where do you look first?

Show the answer

Answer: a

Repeatability is variation with the same person and part. If it dominates, the gauge itself needs attention. Large reproducibility points to people or procedure.

Check yourself

You choose ten parts for the study, all from one good batch, and they look almost identical. How does that affect % study variation?

Show the answer

Answer: b

Parts should cover the range the process really produces. A narrow set of parts makes any gauge look bad.

Check yourself

Put these in the order a process engineer works.

  1. 1Check that the process is stable on a control chart.
  2. 2Check the measurement system.
  3. 3Compute capability against the specification.

Show the answer

The order:

  1. Check the measurement system.
  2. Check that the process is stable on a control chart.
  3. Compute capability against the specification.

A chart built on a poor gauge can't be read, and capability needs a stable process.

07

Try it

In the app

In the Quality studio, choose Process monitoring and open the Gauge R&R step. It starts from your chart's dataset. Every operator should measure every part the same number of times, in random order, ideally without knowing which part it is.

08

Recap

Recap
  • A gauge study separates the instrument, the people and the parts.
  • % study variation compares standard deviations, and % contribution compares variances.
  • Check distinct categories, and choose parts that span the real range.
  • Do this before you trust charts or capability.

Concepts in this lesson