LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_joint_raw_from_central.m
1function m = moment_joint_raw_from_central(mc, mu)
2% m = moment_joint_raw_from_central(mc, mu)
3%
4% Converts the joint central moments of a random vector into the joint power
5% (raw) moments, by the multi-index binomial theorem,
6%
7% m_(i) = sum_(k<=i) prod_j nchoosek(i_j,k_j) mu_j^(i_j-k_j) * mc_(k)
8%
9% The mean vector must be supplied separately, since the first-order central
10% moments are zero and carry no information on it. Inverse of
11% moment_joint_central_from_raw.
12%
13% Input:
14% mc: array of size (n_1+1)x...x(n_d+1) holding the joint central moments
15% mu: vector of length d holding the means E[N_1],...,E[N_d]
16%
17% Output:
18% m: array of the same size as mc holding the joint power moments
19%
20% Example:
21% m = moment_joint_raw_from_central(moment_joint_central_from_raw(m0), mu);
22%
23% Reference:
24% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
25% distributions. PMCCS, 2003, Section 4.
26
27sz = moment_tensorsize(mc);
28d = numel(sz);
29if numel(mu) ~= d
30 line_error(mfilename,'The mean vector mu must have one entry per dimension of mc.');
31end
32m = mc;
33for mode = 1:d
34 n = sz(mode)-1;
35 T = zeros(n+1,n+1);
36 for i = 0:n
37 for k = 0:i
38 T(i+1,k+1) = nchoosek(i,k) * mu(mode)^(i-k);
39 end
40 end
41 m = moment_tensortrans(m, T, mode);
42end
43end