std_dev::regression::derived

Function exponential

source
pub fn exponential<E: LinearEstimator>(
    predictors: &mut [f64],
    outcomes: &mut [f64],
    estimator: &E,
) -> ExponentialCoefficients
Available on crate feature regression only.
Expand description

Fits a curve with the equation y = a * b^x (optionally with an additional subtractive term if any outcome is < 1 and an additive to the x if any predictor is < 1).

§Panics

Panics if either x or y don’t have the length len. len must be greater than 2.

§Derivation

y=b * a^x

lg(y) = lg(b * a^x) lg(y) = lg(b) + x(lg a)

Transform: y => lg (y), x => x

When values found, take 10^b to get b and 10^a to get a