pub fn validate_regression_data(y: &[f64], x_vars: &[Vec<f64>]) -> Result<()>Expand description
Validates regression input data for dimensions and finite values.
This is a high-performance validation function that checks:
- All predictor variables have the same length as the response
- Response variable contains no NaN or infinite values
- All predictor variables contain no NaN or infinite values
Uses explicit loops for maximum performance (no closure overhead).
§Arguments
y- Response variable (n observations)x_vars- Predictor variables (each expected to have length n)
§Returns
Ok(()) if all validations pass, otherwise an error indicating the specific issue.
§Errors
Error::DimensionMismatch- if any x_var has different length than yError::InvalidInput- if y or x_vars contain NaN or infinite values
§Examples
ⓘ
use linreg_core::diagnostics::helpers::validate_regression_data;
let y = vec![1.0, 2.0, 3.0];
let x1 = vec![1.0, 2.0, 3.0];
let x2 = vec![2.0, 4.0, 6.0];
validate_regression_data(&y, &[x1, x2])?;