LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_joint_aggregate.m
1function f = moment_joint_aggregate(F)
2% f = moment_joint_aggregate(F)
3%
4% Factorial moments of a total count from the joint factorial moments of its
5% parts. For N = N_1+...+N_d the Vandermonde convolution of falling factorials
6% gives
7%
8% f_n = sum_(|a|=n) (n! / prod_j a_j!) * F_a
9%
10% which holds for ANY joint law of the parts, marked or not, and is the inverse
11% direction of moment_joint_marking whenever the marking is multinomial. The
12% order reached is limited by the smallest per-class order in F, since the term
13% a = n*e_j must be available for every j.
14%
15% Input:
16% F: array of size (n_1+1)x...x(n_d+1) holding the joint factorial moments of
17% the parts
18%
19% Output:
20% f: column vector of length min_j(n_j)+1 holding f_0,...,f_min_j(n_j), the
21% factorial moments of the total
22%
23% Example:
24% f = moment_joint_aggregate(moment_joint_marking([1, 2, 4], [0.3, 0.7], [1, 1]));
25%
26% Reference:
27% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
28% distributions. PMCCS, 2003.
29
30sz = moment_tensorsize(F);
31d = numel(sz);
32nel = prod(sz);
33nmax = min(sz) - 1;
34Fv = reshape(F, [], 1);
35f = zeros(nmax+1,1);
36a = ones(1,d);
37for ia = 1:nel
38 ord = a - 1;
39 n = sum(ord);
40 if n <= nmax
41 f(n+1) = f(n+1) + factorial(n) / prod(factorial(ord)) * Fv(ia);
42 end
43 for l = 1:d
44 a(l) = a(l) + 1;
45 if a(l) <= sz(l)
46 break
47 end
48 a(l) = 1;
49 end
50end
51end