1function mc = moment_central_from_raw(m)
2% mc = moment_central_from_raw(m)
4% Converts
the power (raw) moments m_n = E[N^n] of a random variable N into
5%
the central moments m_n^c = E[(N-m_1)^n] by means of
the binomial transform
6% in
the variation that involves
the mean m_1,
8% m_n^c = sum_{k=0}^{n} (-1)^(n-k) * nchoosek(n,k) * m_k * m_1^(n-k)
10% The conversion also holds
for continuous random variables.
13% m: vector of length n+1 holding m_0,...,m_n, i.e. m(i)
is the moment of
14% order i-1 and m(1) = m_0 = 1. At least
the mean m_1 must be given,
18% mc: vector of length n+1 holding m_0^c,...,m_n^c, with
the same
19% orientation as m. By construction m_0^c = 1 and m_1^c = 0
22% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
23% distributions. PMCCS, 2003, Section 4.
26% mc = moment_central_from_raw([1,2,6,22])
31 line_error(mfilename,
'The mean m_1 is required for this conversion, hence m must have at least 2 elements.');
37 mc(i+1) = mc(i+1) + (-1)^(i-k) * nchoosek(i,k) * mcol(k+1) * m1^(i-k);