Function rgsl::fit::wlinear[][src]

pub fn wlinear(
    x: &[f64],
    xstride: usize,
    w: &[f64],
    wstride: usize,
    y: &[f64],
    ystride: usize,
    n: usize
) -> (Value, f64, f64, f64, f64, f64, f64)
Expand description

This function computes the best-fit linear regression coefficients (c0,c1) of the model Y = c_0 + c_1 X for the weighted dataset (x, y), two vectors of length n with strides xstride and ystride.

The vector w, of length n and stride wstride, specifies the weight of each datapoint.

The weight is the reciprocal of the variance for each datapoint in y.

The covariance matrix for the parameters (c0, c1) is computed using the weights and returned via the parameters (cov00, cov01, cov11). The weighted sum of squares of the residuals from the best-fit line, \chi^2, is returned in chisq.

Returns (Value, c0, c1, cov00, cov01, cov11, chisq).