LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_lah.m
1function L = moment_lah(n)
2% L = moment_lah(n)
3%
4% Triangle of the Lah numbers L(i,j) = (i!/j!)*nchoosek(i-1,j-1), which link
5% the factorial moments to the upward-factorial moments. The triangle is built
6% from the equivalent recursion
7%
8% L(i,j) = L(i-1,j-1) + (i+j-1)*L(i-1,j) for j > 0
9% L(0,0) = 1, L(i,0) = 0 for i > 0
10%
11% which avoids the overflow of the explicit factorial form for large orders.
12%
13% Input:
14% n: maximum order (n >= 0)
15%
16% Output:
17% L: (n+1)x(n+1) matrix with L(i+1,j+1) = L(i,j) in the 0-based notation of
18% the reference. Entries with j > i are zero.
19%
20% Reference:
21% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
22% distributions. PMCCS, 2003, Section 4.
23% I. Lah. Eine neue Art von Zahlen, ihre Eigenschaften und Anwendung in der
24% mathematischen Statistik. Mitteilungsbl. Math. Statist., 7:203-212, 1955.
25%
26% Example:
27% L = moment_lah(3)
28
29if ~isscalar(n) || n < 0 || n ~= round(n)
30 line_error(mfilename,'The maximum order n must be a nonnegative integer.');
31end
32L = zeros(n+1,n+1);
33L(1,1) = 1;
34for i = 1:n
35 for j = 1:i
36 L(i+1,j+1) = L(i,j) + (i+j-1)*L(i,j+1);
37 end
38end
39end
Definition Station.m:245