Statistical Methods

Check the axis before subtracting matrix reference values

Define the task

When a worksheet contains sites in rows and instruments in columns, write out what each reference represents. A column-specific calibration offset must follow the instrument even if someone reorders the columns. Match identifiers and reject absent, duplicate or unmatched labels before converting a labeled table to a numeric matrix.

Carry out the check

Subtract the matching offset from every cell on its intended margin. In R a two-dimensional matrix uses margin 1 for rows and 2 for columns. Verify a cell from each axis by hand. Repeat with permuted column order. A square matrix is a particularly risky test case because a transposed offset can still have the expected length.

Worked hypothetical example

For a hypothetical first row of 12 and 30 units and instrument offsets of 2 and 5, the adjusted row is 10 and 25. Applying the first site's offset of 2 across that row instead yields 10 and 28. The first cell passes either implementation. Keep the second sentinel cell in the regression check.

Method checked 10 November 2026 against R documentation: Sweep out Array Summaries.

Related reading

Reading path: Analyze data. Guide 110 of 112. Choose any guide to suit your project.

Statistical Methods

Inspect Residuals Against Fitted Values Before Trusting a Regression

Use residual patterns to distinguish mean-shape problems, changing spread, and observations needing investigation.

Statistical Methods

Make Regression Reference Categories Explicit

Audit factor levels and coefficient meanings so model tables and predictions describe the intended comparison.

Browse this reading pathTools for this stageGuides and downloads for this stage