LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_upfactorial_from_factorial.m
1function fp = moment_upfactorial_from_factorial(f)
2% fp = moment_upfactorial_from_factorial(f)
3%
4% Converts the factorial moments f_n = E[N(N-1)...(N-n+1)] of a discrete
5% random variable N into the upward-factorial moments
6% f_n^+ = E[N(N+1)...(N+n-1)] by means of the Lah numbers,
7%
8% f_n^+ = sum_{k=1}^{n} L(n,k) * f_k for n >= 1
9% f_0^+ = 1
10%
11% Input:
12% f: vector of length n+1 holding f_0,...,f_n, i.e. f(i) is the moment of
13% order i-1 and f(1) = f_0 = 1
14%
15% Output:
16% fp: vector of length n+1 holding f_0^+,...,f_n^+, with the same
17% orientation as f
18%
19% Reference:
20% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
21% distributions. PMCCS, 2003, Section 4.
22%
23% Example:
24% fp = moment_upfactorial_from_factorial([1,2,4,8])
25
26fcol = f(:);
27n = length(fcol)-1;
28L = moment_lah(n);
29fp = zeros(n+1,1);
30fp(1) = 1;
31for i = 1:n
32 for k = 1:i
33 fp(i+1) = fp(i+1) + L(i+1,k+1) * fcol(k+1);
34 end
35end
36if isrow(f)
37 fp = fp.';
38end
39end
Definition Station.m:245