[][src]Function rstats::gwmean

pub fn gwmean(dvec: &[i64]) -> Result<f64>

Time linearly weighted geometric mean of an i64 slice.
Linearly descending weights from n down to one.
Time dependent data should be in the stack order - the last being the oldest.
The geometric mean is just an exponential of an arithmetic mean of log data (natural logarithms of the data items).
The geometric mean is less sensitive to outliers near maximal value.
Zero data is not allowed - would at best only produce zero result.

Example

use rstats::gwmean;
const VEC1:[i64;14] = [1,2,3,4,5,6,7,8,9,10,11,12,13,14];
assert_eq!(gwmean(&VEC1).unwrap(),4.144953510241978_f64);