validate_regression_data

Function validate_regression_data 

Source
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:

  1. All predictor variables have the same length as the response
  2. Response variable contains no NaN or infinite values
  3. 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

§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])?;