Regression Calibration (RC)¶
Regression Calibration is a classical method for correcting measurement error in inputs (errors-in-variables). When the observed input \(W\) is a noisy version of the true input \(X\), naive regression on \(W\) produces attenuated (biased-toward-zero) estimates.
The idea
Estimate \(\;\mathbb{E}[X \mid W]\;\) — the most likely true input given the noisy observation — and train on those calibrated inputs instead.
The Attenuation Problem¶
When inputs have additive Gaussian measurement error:
the naive OLS estimate of \(\beta\) is biased:
Every entry of the reliability matrix \(\Lambda\) satisfies \(0 \leq \Lambda_{ij} \leq 1\), so coefficients are shrunk toward zero.
The RC Correction¶
RC estimates calibrated inputs via the conditional expectation:
where:
| Symbol | Definition |
|---|---|
| \(\bar{W}\) | Sample mean of observed inputs |
| \(\Sigma_w = \text{Cov}(W)\) | Observed covariance |
| \(\hat\Sigma_x = \Sigma_w - \Sigma_u\) | Estimated signal covariance (clamped PSD) |
| \(\Lambda = \hat\Sigma_x\,(\hat\Sigma_x + \Sigma_u)^{-1}\) | Reliability matrix |
Usage¶
import torch
from torchregress.algorithms import RegressionCalibration
# Known measurement error (scalar, vector, or covariance matrix)
rc = RegressionCalibration(sigma_u=0.5)
# Fit on observed noisy inputs, then transform
X_calibrated = rc.fit_transform(X_observed)
# Or separate fit / transform steps for new data
rc.fit(X_observed)
X_cal_new = rc.transform(X_new)
sigma_u format |
Interpretation |
|---|---|
float |
Isotropic noise — same std for all features |
1-D Tensor |
Per-feature standard deviations |
2-D Tensor |
Full noise covariance matrix \(\Sigma_u\) |
rc.posterior(X, sigma_u=...) accepts the same formats (plus per-sample (N, D) standard deviations) and uses the given sigma_u instead of the one stored at fit.
When to Use¶
Good fit for RC
- Known measurement uncertainties on inputs
- Noise is approximately Gaussian
- You want a fast, analytical correction (no retraining)
Limitations
- Assumes the relationship between \(X\) and \(Y\) is approximately linear in the correction
- For nonlinear models, SIMEX is more flexible
- PSD Clamping: If measurement noise exceeds the observed signal (\(\Sigma_u > \Sigma_w\)), the estimated signal covariance \(\hat\Sigma_x = \Sigma_w - \Sigma_u\) becomes negative. The implementation clamps the eigenvalues to a small positive value (
1e-6times the mean variance of \(W\), so the correction is invariant to the units of the inputs), but this means RC cannot recover when noise dominates signal. - Homoscedastic noise only: RC assumes a single measurement error covariance \(\Sigma_u\) for all samples. It cannot handle heteroscedastic measurement error where different samples have different noise levels.
Limitations¶
- Linear correction only: RC applies a linear shrinkage \(\Lambda \cdot (W - \bar{W})\). For nonlinear \(f(X)\), the debiasing is approximate at best. Use SIMEX or EIV losses for nonlinear models.
- PSD clamping: If measurement noise exceeds the observed signal (\(\Sigma_u > \Sigma_w\)), the estimated signal covariance \(\hat\Sigma_x = \Sigma_w - \Sigma_u\) becomes negative. RC clamps to a small positive value but cannot recover when noise dominates signal.
- Homoscedastic noise only: RC assumes a single \(\Sigma_u\) for all samples. Heteroscedastic measurement error is not supported.
- Gaussian noise assumption: The conditional expectation \(\mathbb{E}[X \mid W]\) is exact only under joint Gaussian \((X, W)\). For non-Gaussian noise, RC is a best-linear predictor, not the true conditional expectation.
- Known \(\Sigma_u\) required: RC requires the measurement error covariance as a known input. It does not estimate \(\Sigma_u\) from data.
Recommendations¶
- Default for linear models: RC is the fastest, simplest EIV correction. Apply it first, then validate on held-out data before considering more complex methods.
- For nonlinear models: If RC's linear correction is insufficient (validate on test set), upgrade to SIMEX (flexible but expensive) or LatentNN (joint optimisation).
- Validate the correction: Compare RC-corrected predictions against a naive baseline on clean held-out data (if available) or via simulation with known ground truth.
- Combine with robust losses: RC corrects input noise. Pair with Robust losses to handle outlier targets simultaneously.
Next steps¶
- SIMEX — simulation-extrapolation for nonlinear models where RC's linear correction is insufficient
- LatentNN — joint optimisation of latent clean inputs and model parameters
- EIV losses — functional and structural error-in-variables losses at the loss level
- Error-Aware Encoding — quality-gated feature engineering from known measurement noise
References¶
| # | Reference |
|---|---|
| 1 | R.J. Carroll, D. Ruppert, L.A. Stefanski, C.M. Crainiceanu. Measurement Error in Nonlinear Models. 2nd ed., Chapman & Hall/CRC, 2006. |
| 2 | W.A. Fuller. Measurement Error Models. Wiley, 1987. |