pub struct RegressionOutput {Show 23 fields
pub coefficients: Vec<f64>,
pub std_errors: Vec<f64>,
pub t_stats: Vec<f64>,
pub p_values: Vec<f64>,
pub conf_int_lower: Vec<f64>,
pub conf_int_upper: Vec<f64>,
pub r_squared: f64,
pub adj_r_squared: f64,
pub f_statistic: f64,
pub f_p_value: f64,
pub mse: f64,
pub rmse: f64,
pub mae: f64,
pub std_error: f64,
pub residuals: Vec<f64>,
pub standardized_residuals: Vec<f64>,
pub predictions: Vec<f64>,
pub leverage: Vec<f64>,
pub vif: Vec<VifResult>,
pub n: usize,
pub k: usize,
pub df: usize,
pub variable_names: Vec<String>,
}Expand description
Complete output from OLS regression.
Contains all coefficients, statistics, diagnostics, and residuals from an Ordinary Least Squares regression.
§Example
let y = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let x1 = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let names = vec!["Intercept".to_string(), "X1".to_string()];
let result = ols_regression(&y, &[x1], &names).unwrap();
assert!(result.r_squared > 0.0);
assert_eq!(result.coefficients.len(), 2); // intercept + 1 predictorFields§
§coefficients: Vec<f64>Regression coefficients (including intercept)
std_errors: Vec<f64>Standard errors of coefficients
t_stats: Vec<f64>t-statistics for coefficient significance tests
p_values: Vec<f64>Two-tailed p-values for coefficients
conf_int_lower: Vec<f64>Lower bounds of 95% confidence intervals
conf_int_upper: Vec<f64>Upper bounds of 95% confidence intervals
r_squared: f64R-squared (coefficient of determination)
adj_r_squared: f64Adjusted R-squared (accounts for number of predictors)
f_statistic: f64F-statistic for overall model significance
f_p_value: f64P-value for F-statistic
mse: f64Mean squared error of residuals
rmse: f64Root mean squared error (prediction error in original units)
mae: f64Mean absolute error of residuals
std_error: f64Standard error of the regression (residual standard deviation)
residuals: Vec<f64>Raw residuals (observed - predicted)
standardized_residuals: Vec<f64>Standardized residuals (accounting for leverage)
predictions: Vec<f64>Fitted/predicted values
leverage: Vec<f64>Leverage values for each observation (diagonal of hat matrix)
vif: Vec<VifResult>Variance Inflation Factors for detecting multicollinearity
n: usizeNumber of observations
k: usizeNumber of predictor variables (excluding intercept)
df: usizeDegrees of freedom for residuals (n - k - 1)
variable_names: Vec<String>Names of variables (including intercept)
Trait Implementations§
Source§impl Clone for RegressionOutput
impl Clone for RegressionOutput
Source§fn clone(&self) -> RegressionOutput
fn clone(&self) -> RegressionOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more