Gage Linearity and Bias Study (manufacturing-quality/as9100/gage-linearity-bias-study)
Use when the task is judging a gage's bias and linearity at the
conceptual level: reference-level masters are measured repeatedly, the
bias (observed minus reference) is recorded at each level, and the study
asks whether the gage reads true on average (bias significance test) and
whether the bias grows across the measurement range (linearity
regression of bias on the reference value). This leaf implements the
per-level bias, the mean bias, the least-squares linearity statistics,
the t test against the two-sided 95 percent critical at the study
degrees of freedom, and the percent-of-reference acceptability band, in
pure Python, stdlib only. It pairs with
manufacturing-quality/as9100/measurement-systems-analysis for the
repeatability and reproducibility variance decomposition (which does not
compute bias or linearity studies), and with
manufacturing-quality/as9100/calibration-control for instrument
calibration state and traceability.
Domain quick reference
- Conventions: references are the certified master values in mm, one
strictly increasing unique value per level; one bias per level with
bias = observed - reference (signed mm, positive means the gage reads
high); n = number of reference levels (3 or more).
- Per-level bias and percent of reference:
bias_pct_i = 100 * bias_i / reference_i. A level is acceptable when
|bias_pct| <= 10 percent of reference (ACCEPTANCE_PCT_BAND).
- Mean bias: bias_bar = sum(bias_i) / n. The spread terms:
sst = sum (bias_i - bias_bar)^2 and s = sqrt(sst / (n - 1)).
- Bias significance: t = bias_bar / (s / sqrt(n)) against the two-sided
95 percent t critical at df = n - 1 (12.706 at 1 df down to 2.086 at
20 df, 1.96 above 20 df); significant when |t| >= t_crit.
- Linearity regression: least squares fit bias = intercept + slope *
reference, with slope = Sxy / Sxx and intercept = bias_bar - slope *
xbar over the level values; sse = sum (bias_i - predicted_i)^2 and
r2 = 1 - sse / sst measure how well a straight line carries the bias
trend across the range.
- Overall verdict: ACCEPT when the mean bias is not statistically
significant AND every level is inside the percent band, else REVIEW.
A significant mean bias alone forces REVIEW even when all levels are
inside the band.
- AS9100 frames monitoring and measuring resources as controlled and
fit for purpose; the bias and linearity study is one common
measurement-system evidence practice in that context, summarized here
without clause text.
Workflow
- Collect the study inputs: reference masters (mm) and the measured
bias at each level (mm), as equal-length lists with 3 or more
strictly increasing positive references.
- Get the per-level table with per_level_bias(references, biases):
reference, bias and bias_pct_of_reference per level.
- Read the overall mean bias with mean_bias(biases).
- Fit the linearity evidence with linearity_regression(references,
biases): slope, intercept, sse, r_squared, n, xbar, bias_bar.
- Test the mean bias with bias_significance(biases): t_stat, t_crit,
df and the significant flag.
- Run the whole study with gage_bias_linearity_study(references,
biases) for the combined verdict: worst_bias_pct, worst_reference,
per_level_acceptable and overall ACCEPT or REVIEW.
- Confirm the deterministic checks with the contract test
scripts/test_gage_linearity_bias_study.py.
Worked example
Reference study: masters [2, 4, 6, 8, 10] mm with measured biases
[0.07, 0.10, 0.16, 0.18, 0.24] mm. Module outputs:
- Per-level bias percent of reference: 3.50, 2.50, 2.67, 2.25, 2.40
percent (real module values 3.5, 2.5, 2.6667, 2.25, 2.4), all inside
the 10 percent band.
- Mean bias = 0.150 mm; sst = 0.0180; s = 0.06708 mm.
- Linearity regression: slope = 0.0210 mm/mm, intercept = 0.0240 mm,
sse = 0.00036, r2 = 0.980 (bias grows about 0.021 mm per mm of
reference).
- Bias significance: t = 0.150 / (0.06708 / sqrt(5)) = 5.000; df = 4;
t_crit = 2.776; |5.000| >= 2.776, so significant = True.
- Worst percent bias = 3.50 percent at the 2 mm level; all levels are
inside the 10 percent band, yet the study verdict is REVIEW because
the mean bias is statistically significant.
Verification
- Confirm per_level_bias on the anchor returns the five rows with
bias_pct_of_reference 3.50, 2.50, 2.67, 2.25, 2.40 within 1e-2, and
that mean_bias returns 0.150.
- Confirm linearity_regression returns slope 0.0210 within 1e-4,
intercept 0.0240 within 1e-3, sse 0.00036 within 1e-5 and r2 0.980
within 1e-3, that the regression residuals sum to zero within 1e-9,
and that r2 equals 1 - sse/sst exactly.
- Confirm bias_significance returns t = bias_bar / (s / sqrt(n)) exactly
per the formula (5.000 on the anchor), t_crit 2.776 at 4 df, and
significant True; a small-bias fixture with all biases 0.01 returns
significant False.
- Confirm gage_bias_linearity_study returns REVIEW on the anchor
(significant bias despite the band) and ACCEPT on the all-biases-0.01
fixture.
- Confirm ValueError rejection of mismatched arrays, fewer than 3
levels, references that are not strictly increasing, any reference
at or below zero, and empty bias lists.
- Deterministic, offline: run python3
scripts/test_gage_linearity_bias_study.py (29 tests, exit 0).
Related leaves
- manufacturing-quality/as9100/measurement-systems-analysis: the
repeatability and reproducibility variance decomposition with percent
contributions and distinct categories; it does not compute bias or
linearity studies.
- manufacturing-quality/as9100/attribute-agreement-analysis: agreement
analysis for attribute go/no-go judgments instead of variable-data
bias studies.
- manufacturing-quality/as9100/calibration-control: calibration state,
recall and traceability of the instrument behind the study.
- cross-cutting/numerics/least-squares-regression: the generic fitting
machinery without the gage verdict framing.
Pitfalls
- Reading a significant mean bias as an automatic failure: the t test
compares the mean bias against the spread of the level biases, so the
anchor's 0.150 mm mean bias is significant (t = 5.000 against 2.776)
even though every level sits inside the 10 percent band; the verdict
REVIEW, not ACCEPT, is the correct joint reading of both gates.
- Reading the percent band as the only gate: a mean bias can be tiny
but statistically significant when the level biases are tightly
grouped, so the significance test and the band must both pass before
ACCEPT.
- Dividing by zero on uniform bias: identical biases across levels give
s = 0 and an undefined t; the study reports t_stat 0.0 and
significant False (zero-dispersion convention) and lets the percent
band decide.
- Forgetting the bias sign: bias is observed minus reference, so a
positive bias means the gage reads high and the regression slope
carries the sign of the linearity drift.
- Using the wrong degrees of freedom: df = n - 1 with n the number of
reference levels, not the number of readings per level; above 20 df
the t critical is 1.96, not an extrapolated table value.
- Feeding non-positive or unordered masters: the percent of reference
blows up near zero and an unordered level list breaks the fit;
references must be strictly increasing positive values (ValueError).
- Routing variance-decomposition questions here: the repeatability and
reproducibility study with its percent-of-total verdicts belongs to
measurement-systems-analysis; this leaf owns only the reference-level
bias and linearity study.
- Routing generic fit questions here: a bare least-squares regression
without gage verdict framing belongs to
cross-cutting/numerics/least-squares-regression.
Behavior contract (gate 3)
Run the deterministic contract test (stdlib unittest, offline):
python3 scripts/test_gage_linearity_bias_study.py
The test covers the anchor worked example (masters [2, 4, 6, 8, 10] mm,
biases [0.07, 0.10, 0.16, 0.18, 0.24] mm: per-level percents within
1e-2, slope 0.0210, intercept 0.0240, sse 0.00036, r2 0.980, t 5.000
with t_crit 2.776 at 4 df, verdict REVIEW), the residual-sum-zero and
r2 = 1 - sse/sst and t-formula identities, the small-bias fixture
(all biases 0.01: not significant, ACCEPT), the zero-dispersion
convention, the large-df normal critical 1.96, the t critical table
spot checks, the ACCEPT/REVIEW verdict logic including the band-breach
case, and ValueError rejection of mismatched arrays, fewer than 3
levels, non-increasing or non-positive references and empty biases.
Compliance
- Standards referenced, not reproduced: AS9100 is cited as reference
context only (measurement system analysis in the AS9100/AS9102
environment); no standard text is reproduced and the study equations
above are standard engineering methodology, summary-only per
standards-map.yaml.
- compliance: STANDARDS-REF, gated: false.
1---2name: gage-linearity-bias-study3description: Use when you must run the gage bias and linearity study: compute the per-level bias and the overall mean bias from reference masters and measured biases, fit the least-squares regression of bias on the reference value returning the slope, intercept, residual sum of squares and R-squared as the linearity evidence, test the mean bias for significance against the two-sided 95 percent t critical at the study degrees of freedom, and apply the percent-of-reference acceptability band per level. Produces per-level bias, mean bias, the regression linearity statistics, the bias significance verdict, the worst percent bias and an overall study verdict. Trigger: gage linearity and bias, measurement bias study, bias significance test, gage linearity regression, percent of reference band, linearity percent band, msa bias analysis.4license: Apache-2.05---67# Gage Linearity and Bias Study (manufacturing-quality/as9100/gage-linearity-bias-study)89Use when the task is judging a gage's bias and linearity at the10conceptual level: reference-level masters are measured repeatedly, the11bias (observed minus reference) is recorded at each level, and the study12asks whether the gage reads true on average (bias significance test) and13whether the bias grows across the measurement range (linearity14regression of bias on the reference value). This leaf implements the15per-level bias, the mean bias, the least-squares linearity statistics,16the t test against the two-sided 95 percent critical at the study17degrees of freedom, and the percent-of-reference acceptability band, in18pure Python, stdlib only. It pairs with19manufacturing-quality/as9100/measurement-systems-analysis for the20repeatability and reproducibility variance decomposition (which does not21compute bias or linearity studies), and with22manufacturing-quality/as9100/calibration-control for instrument23calibration state and traceability.2425## Domain quick reference2627- Conventions: references are the certified master values in mm, one28 strictly increasing unique value per level; one bias per level with29 bias = observed - reference (signed mm, positive means the gage reads30 high); n = number of reference levels (3 or more).31- Per-level bias and percent of reference:32 bias_pct_i = 100 * bias_i / reference_i. A level is acceptable when33 |bias_pct| <= 10 percent of reference (ACCEPTANCE_PCT_BAND).34- Mean bias: bias_bar = sum(bias_i) / n. The spread terms:35 sst = sum (bias_i - bias_bar)^2 and s = sqrt(sst / (n - 1)).36- Bias significance: t = bias_bar / (s / sqrt(n)) against the two-sided37 95 percent t critical at df = n - 1 (12.706 at 1 df down to 2.086 at38 20 df, 1.96 above 20 df); significant when |t| >= t_crit.39- Linearity regression: least squares fit bias = intercept + slope *40 reference, with slope = Sxy / Sxx and intercept = bias_bar - slope *41 xbar over the level values; sse = sum (bias_i - predicted_i)^2 and42 r2 = 1 - sse / sst measure how well a straight line carries the bias43 trend across the range.44- Overall verdict: ACCEPT when the mean bias is not statistically45 significant AND every level is inside the percent band, else REVIEW.46 A significant mean bias alone forces REVIEW even when all levels are47 inside the band.48- AS9100 frames monitoring and measuring resources as controlled and49 fit for purpose; the bias and linearity study is one common50 measurement-system evidence practice in that context, summarized here51 without clause text.5253## Workflow54551. Collect the study inputs: reference masters (mm) and the measured56 bias at each level (mm), as equal-length lists with 3 or more57 strictly increasing positive references.582. Get the per-level table with per_level_bias(references, biases):59 reference, bias and bias_pct_of_reference per level.603. Read the overall mean bias with mean_bias(biases).614. Fit the linearity evidence with linearity_regression(references,62 biases): slope, intercept, sse, r_squared, n, xbar, bias_bar.635. Test the mean bias with bias_significance(biases): t_stat, t_crit,64 df and the significant flag.656. Run the whole study with gage_bias_linearity_study(references,66 biases) for the combined verdict: worst_bias_pct, worst_reference,67 per_level_acceptable and overall ACCEPT or REVIEW.687. Confirm the deterministic checks with the contract test69 scripts/test_gage_linearity_bias_study.py.7071## Worked example7273Reference study: masters [2, 4, 6, 8, 10] mm with measured biases74[0.07, 0.10, 0.16, 0.18, 0.24] mm. Module outputs:7576- Per-level bias percent of reference: 3.50, 2.50, 2.67, 2.25, 2.4077 percent (real module values 3.5, 2.5, 2.6667, 2.25, 2.4), all inside78 the 10 percent band.79- Mean bias = 0.150 mm; sst = 0.0180; s = 0.06708 mm.80- Linearity regression: slope = 0.0210 mm/mm, intercept = 0.0240 mm,81 sse = 0.00036, r2 = 0.980 (bias grows about 0.021 mm per mm of82 reference).83- Bias significance: t = 0.150 / (0.06708 / sqrt(5)) = 5.000; df = 4;84 t_crit = 2.776; |5.000| >= 2.776, so significant = True.85- Worst percent bias = 3.50 percent at the 2 mm level; all levels are86 inside the 10 percent band, yet the study verdict is REVIEW because87 the mean bias is statistically significant.8889## Verification9091- Confirm per_level_bias on the anchor returns the five rows with92 bias_pct_of_reference 3.50, 2.50, 2.67, 2.25, 2.40 within 1e-2, and93 that mean_bias returns 0.150.94- Confirm linearity_regression returns slope 0.0210 within 1e-4,95 intercept 0.0240 within 1e-3, sse 0.00036 within 1e-5 and r2 0.98096 within 1e-3, that the regression residuals sum to zero within 1e-9,97 and that r2 equals 1 - sse/sst exactly.98- Confirm bias_significance returns t = bias_bar / (s / sqrt(n)) exactly99 per the formula (5.000 on the anchor), t_crit 2.776 at 4 df, and100 significant True; a small-bias fixture with all biases 0.01 returns101 significant False.102- Confirm gage_bias_linearity_study returns REVIEW on the anchor103 (significant bias despite the band) and ACCEPT on the all-biases-0.01104 fixture.105- Confirm ValueError rejection of mismatched arrays, fewer than 3106 levels, references that are not strictly increasing, any reference107 at or below zero, and empty bias lists.108- Deterministic, offline: run python3109 scripts/test_gage_linearity_bias_study.py (29 tests, exit 0).110111## Related leaves112113- manufacturing-quality/as9100/measurement-systems-analysis: the114 repeatability and reproducibility variance decomposition with percent115 contributions and distinct categories; it does not compute bias or116 linearity studies.117- manufacturing-quality/as9100/attribute-agreement-analysis: agreement118 analysis for attribute go/no-go judgments instead of variable-data119 bias studies.120- manufacturing-quality/as9100/calibration-control: calibration state,121 recall and traceability of the instrument behind the study.122- cross-cutting/numerics/least-squares-regression: the generic fitting123 machinery without the gage verdict framing.124125## Pitfalls126127- Reading a significant mean bias as an automatic failure: the t test128 compares the mean bias against the spread of the level biases, so the129 anchor's 0.150 mm mean bias is significant (t = 5.000 against 2.776)130 even though every level sits inside the 10 percent band; the verdict131 REVIEW, not ACCEPT, is the correct joint reading of both gates.132- Reading the percent band as the only gate: a mean bias can be tiny133 but statistically significant when the level biases are tightly134 grouped, so the significance test and the band must both pass before135 ACCEPT.136- Dividing by zero on uniform bias: identical biases across levels give137 s = 0 and an undefined t; the study reports t_stat 0.0 and138 significant False (zero-dispersion convention) and lets the percent139 band decide.140- Forgetting the bias sign: bias is observed minus reference, so a141 positive bias means the gage reads high and the regression slope142 carries the sign of the linearity drift.143- Using the wrong degrees of freedom: df = n - 1 with n the number of144 reference levels, not the number of readings per level; above 20 df145 the t critical is 1.96, not an extrapolated table value.146- Feeding non-positive or unordered masters: the percent of reference147 blows up near zero and an unordered level list breaks the fit;148 references must be strictly increasing positive values (ValueError).149- Routing variance-decomposition questions here: the repeatability and150 reproducibility study with its percent-of-total verdicts belongs to151 measurement-systems-analysis; this leaf owns only the reference-level152 bias and linearity study.153- Routing generic fit questions here: a bare least-squares regression154 without gage verdict framing belongs to155 cross-cutting/numerics/least-squares-regression.156157## Behavior contract (gate 3)158159Run the deterministic contract test (stdlib unittest, offline):160161 python3 scripts/test_gage_linearity_bias_study.py162163The test covers the anchor worked example (masters [2, 4, 6, 8, 10] mm,164biases [0.07, 0.10, 0.16, 0.18, 0.24] mm: per-level percents within1651e-2, slope 0.0210, intercept 0.0240, sse 0.00036, r2 0.980, t 5.000166with t_crit 2.776 at 4 df, verdict REVIEW), the residual-sum-zero and167r2 = 1 - sse/sst and t-formula identities, the small-bias fixture168(all biases 0.01: not significant, ACCEPT), the zero-dispersion169convention, the large-df normal critical 1.96, the t critical table170spot checks, the ACCEPT/REVIEW verdict logic including the band-breach171case, and ValueError rejection of mismatched arrays, fewer than 3172levels, non-increasing or non-positive references and empty biases.173174## Compliance175176- Standards referenced, not reproduced: AS9100 is cited as reference177 context only (measurement system analysis in the AS9100/AS9102178 environment); no standard text is reproduced and the study equations179 above are standard engineering methodology, summary-only per180 standards-map.yaml.181- compliance: STANDARDS-REF, gated: false.