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