1function mc = moment_joint_central_from_raw(m)
2% mc = moment_joint_central_from_raw(m)
4% Converts the joint power (raw) moments of a random vector (N_1,...,N_d) into
5% the joint central moments mc_(i_1,...,i_d) = E[prod_j (N_j - E N_j)^(i_j)].
7% The conversion
is the multi-index binomial theorem, which
is again separable
8% but with a different shift per dimension,
10% mc_(i) =
sum_(k<=i) prod_j (-1)^(i_j-k_j) nchoosek(i_j,k_j) mu_j^(i_j-k_j)
13% The means mu_j = m_(e_j) are read off the array itself, so every dimension
14% must carry at least the first order. The entry of multi-order e_j+e_l
is the
15% covariance of N_j and N_l.
18% m: array of size (n_1+1)x...x(n_d+1) holding the joint power moments, with
22% mc: array of the same size holding the joint central moments
25% mc = moment_joint_central_from_raw(m);
28% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
29% distributions. PMCCS, 2003, Section 4.
31sz = moment_tensorsize(m);
34 line_error(mfilename,'The means m_(e_j) are required for this conversion, hence every dimension of m must have at least 2 elements.');
37stride = cumprod([1, sz(1:end-1)]);
38mv = reshape(m, [], 1);
40 mu(j) = mv(1 + stride(j));
42mc = moment_joint_central_from_raw_mean(m, mu);