Principle
Among all candidate references the least-squares reference minimises the sum of squared residuals. For a line, the parameters follow uniquely from the means and covariance of the coordinates; for a plane it is a two-variable linear regression. The peak-to-valley residual range serves as the profile error. Because squaring magnifies outliers, a single anomalous point pulls the reference; data quality must be checked first.
Preparation
Prepare the point data in a common frame and screen for obvious outliers. Verify the regression formulas and weighting in the spreadsheet or script; equally and unequally spaced data differ. Document data provenance and any exclusion decisions for traceability.
Workflow diagram
Procedure
- Assemble coordinates and heights; check units, numbering and outliers.
- Compute means and covariances (second-order for a plane).
- Solve the reference: slope b=Sxy/Sxx and intercept a=ȳ−b·x̄.
- Compute residuals ri=zi−(a+b·xi) and verify the orthogonality conditions Σri=0 and Σri·xi=0.
- Take the residual peak-to-valley f=max(ri)−min(ri) as the error value.
- Report the parameters, residual plot and value, identified as a least-squares result.
Calculation
Line reference: b=Sxy/Sxx and a=ȳ−b·x̄, with Sxx=Σ(xi−x̄)² and Sxy=Σ(xi−x̄)(zi−z̄). Residuals ri=zi−a−b·xi give f=max(ri)−min(ri). A plane reference z=a+b·x+c·y is solved from the normal equations. The conditions Σri=0 and Σri·xi=0 serve as program checks.
Illustrative example
Teaching data, not measured: five points at 100 mm spacing with heights [0, 0.5, 1.5, 1.0, 2.0] μm. The fit gives b=0.45 μm per station and a=+0.10 μm; residuals are [−0.10, −0.05, +0.50, −0.45, +0.10] μm with a peak-to-valley of 0.95 μm (demonstration). This is not a minimum-zone value.
Limitations
- Using the residual peak-to-valley as a minimum-zone value for acceptance.
- Fitting with an unchecked outlier that visibly biases the reference.
- Applying equal-spacing shortcut formulas to unequally spaced data.
Reporting
Retain raw data, datum definition, temperature, repeatability, algorithm and uncertainty. Illustrations are not test results.