greeners 1.0.0

High-performance econometrics with R/Python formulas. Two-Way Clustering, Marginal Effects (AME/MEM), HC1-4, IV Predictions, Categorical C(var), Polynomial I(x^2), Interactions, Diagnostics. OLS, IV/2SLS, DiD, Logit/Probit, Panel (FE/RE), Time Series (VAR/VECM), Quantile!
Documentation
use greeners::{OLS, CovarianceType};
use ndarray::{Array1, Array2};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    // Simple example data
    let y = Array1::from(vec![1.0, 3.0, 5.0, 7.0, 9.0]);

    // Matrix X with Intercept (column of 1s) and one explanatory variable
    let x = Array2::from_shape_vec((5, 2), vec![
        1.0, 1.0,
        1.0, 2.0,
        1.0, 3.0,
        1.0, 4.0,
        1.0, 5.0,
    ])?;

    println!("--- Simple Regression (OLS) ---");

    let result = OLS::fit(&y, &x, CovarianceType::NonRobust)?;

    println!("{}", result);

    Ok(())
}