LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_raw_from_central.m
1function m = moment_raw_from_central(mc, m1)
2% m = moment_raw_from_central(mc, m1)
3%
4% Converts the central moments m_n^c = E[(N-m_1)^n] of a random variable N
5% into the power (raw) moments m_n = E[N^n] by means of the inverse binomial
6% transform in the variation that involves the mean m_1,
7%
8% m_n = sum_{k=0}^{n} nchoosek(n,k) * m_k^c * m_1^(n-k)
9%
10% The mean must be supplied separately since m_1^c = 0 carries no information
11% on it. The conversion also holds for continuous random variables.
12%
13% Input:
14% mc: vector of length n+1 holding m_0^c,...,m_n^c, i.e. mc(i) is the moment
15% of order i-1 and mc(1) = m_0^c = 1
16% m1: mean of N
17%
18% Output:
19% m: vector of length n+1 holding m_0,...,m_n, with the same orientation
20% as mc
21%
22% Reference:
23% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
24% distributions. PMCCS, 2003, Section 4.
25%
26% Example:
27% m = moment_raw_from_central(moment_central_from_raw([1,2,6,22]), 2)
28
29mccol = mc(:);
30n = length(mccol)-1;
31if ~isscalar(m1)
32 line_error(mfilename,'The mean m1 must be a scalar.');
33end
34m = zeros(n+1,1);
35for i = 0:n
36 for k = 0:i
37 m(i+1) = m(i+1) + nchoosek(i,k) * mccol(k+1) * m1^(i-k);
38 end
39end
40if isrow(mc)
41 m = m.';
42end
43end
Definition Station.m:245