pub struct GeneralLeastSquares { /* private fields */ }Expand description
Least squares with a known error structure: minimise (y - Xw)ᵀ Σ⁻¹ (y - Xw) where Σ is the
covariance of the errors (generalised least squares), or the special case of independent errors
with per-sample weights (weighted least squares, Σ = diag(1/weight)). This is the best linear
unbiased estimator when Σ is right: noisy or correlated samples count for less.
Implemented by whitening: factor Σ = L Lᵀ and solve the ordinary problem for L⁻¹ y ~ L⁻¹ X.
Implementations§
Source§impl GeneralLeastSquares
impl GeneralLeastSquares
Sourcepub fn with_covariance(covariance: R2D) -> Self
pub fn with_covariance(covariance: R2D) -> Self
Errors with the full covariance matrix Σ (symmetric positive definite, n × n).
Sourcepub fn with_sample_weights(weights: R1D) -> Self
pub fn with_sample_weights(weights: R1D) -> Self
Independent errors with the given positive per-sample weights (inverse variances).
pub fn with_intercept(self, fit_intercept: bool) -> Self
pub fn weights(&self) -> &R1D
pub fn intercept(&self) -> f64
Trait Implementations§
Source§impl Clone for GeneralLeastSquares
impl Clone for GeneralLeastSquares
Source§impl Debug for GeneralLeastSquares
impl Debug for GeneralLeastSquares
Auto Trait Implementations§
impl Freeze for GeneralLeastSquares
impl RefUnwindSafe for GeneralLeastSquares
impl Send for GeneralLeastSquares
impl Sync for GeneralLeastSquares
impl Unpin for GeneralLeastSquares
impl UnsafeUnpin for GeneralLeastSquares
impl UnwindSafe for GeneralLeastSquares
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