pub struct OLS;Implementations§
Source§impl OLS
impl OLS
Sourcepub fn from_formula(
formula: &Formula,
data: &DataFrame,
cov_type: CovarianceType,
) -> Result<OlsResult, GreenersError>
pub fn from_formula( formula: &Formula, data: &DataFrame, cov_type: CovarianceType, ) -> Result<OlsResult, GreenersError>
Fits an OLS model using a formula and DataFrame.
§Examples
use greeners::{OLS, DataFrame, Formula, CovarianceType};
use ndarray::Array1;
use std::collections::HashMap;
let mut data = HashMap::new();
data.insert("y".to_string(), Array1::from(vec![1.0, 2.1, 3.2, 3.9, 5.1]));
data.insert("x1".to_string(), Array1::from(vec![1.0, 2.0, 3.0, 4.0, 5.0]));
data.insert("x2".to_string(), Array1::from(vec![2.0, 2.5, 3.0, 3.5, 4.0]));
let df = DataFrame::new(data).unwrap();
let formula = Formula::parse("y ~ x1 + x2").unwrap();
let result = OLS::from_formula(&formula, &df, CovarianceType::HC1).unwrap();
println!("R-squared: {}", result.r_squared);Sourcepub fn detect_collinearity(
x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
tolerance: f64,
) -> (ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, Vec<usize>, Vec<usize>)
pub fn detect_collinearity( x: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, tolerance: f64, ) -> (ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, Vec<usize>, Vec<usize>)
Detect and remove perfectly collinear columns using QR decomposition.
Returns: (clean_x, keep_indices, omitted_indices)
Auto Trait Implementations§
impl Freeze for OLS
impl RefUnwindSafe for OLS
impl Send for OLS
impl Sync for OLS
impl Unpin for OLS
impl UnsafeUnpin for OLS
impl UnwindSafe for OLS
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.