pub fn raw_moment(central_moments: &[f64], dist_mean: f64) -> Vec<f64>Expand description
Raw moments [E[x], E[x^2], ...] from centred moments and the mean.
central_moments starts at the first centred moment, which is 0:
[0, E[(x - mu)^2], E[(x - mu)^3], ...]. The output has the same length (at least 1):
entry 0 is dist_mean and entry n - 1 is sum_k C(n, k) c_k mu^(n - k) with c_0 = 1.
The first centred moment is used as given in that sum, so pass 0 there.
use openquant::ef3m::raw_moment;
// N(1, 2^2): centred moments 0, 4, 0; raw moments 1, 5, 13.
assert_eq!(raw_moment(&[0.0, 4.0, 0.0], 1.0), [1.0, 5.0, 13.0]);