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