LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_binomial_from_negbinomial.m
1function b = moment_binomial_from_negbinomial(bm)
2% b = moment_binomial_from_negbinomial(bm)
3%
4% Converts the negative-binomial moments b_n^- = E[nchoosek(N+n-1,n)] of a
5% discrete random variable N into the binomial moments b_n = E[nchoosek(N,n)]
6% by means of the shifted binomial transform
7%
8% b_n = sum_{k=1}^{n} (-1)^(n-k) * nchoosek(n-1,k-1) * b_k^- for n >= 1
9% b_0 = 1
10%
11% Input:
12% bm: vector of length n+1 holding b_0^-,...,b_n^-, i.e. bm(i) is the moment
13% of order i-1 and bm(1) = b_0^- = 1
14%
15% Output:
16% b: vector of length n+1 holding b_0,...,b_n, with the same orientation
17% as bm
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% b = moment_binomial_from_negbinomial([1,2,4,22/3])
25
26bmcol = bm(:);
27n = length(bmcol)-1;
28b = zeros(n+1,1);
29b(1) = 1;
30for i = 1:n
31 for k = 1:i
32 b(i+1) = b(i+1) + (-1)^(i-k) * nchoosek(i-1,k-1) * bmcol(k+1);
33 end
34end
35if isrow(bm)
36 b = b.';
37end
38end
Definition Station.m:245