Skip to main content

ridge_prediction_intervals

Function ridge_prediction_intervals 

Source
pub fn ridge_prediction_intervals(
    fit: &RidgeFit,
    x_vars: &[Vec<f64>],
    new_x: &[&[f64]],
    alpha: f64,
) -> Result<PredictionIntervalOutput>
Expand description

Computes approximate prediction intervals for Ridge regression.

Uses the conservative approximation with leverage from unpenalized X’X, MSE from the ridge fit, and effective degrees of freedom from fit.df.

§Arguments

  • fit - Reference to the fitted Ridge model
  • x_vars - Original training predictor variables (each inner vec is one variable)
  • new_x - New predictor values (each inner slice is one variable)
  • alpha - Significance level (e.g., 0.05 for 95% prediction interval)