LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
moment_joint_central_from_raw_mean.m
1function mc = moment_joint_central_from_raw_mean(m, mu)
2% mc = moment_joint_central_from_raw_mean(m, mu)
3%
4% Converts the joint power (raw) moments of a random vector into the joint
5% central moments about a given mean vector. Same conversion as
6% moment_joint_central_from_raw, with the means supplied rather than read off
7% the array, so that it also applies when the array does not carry the
8% first-order entries.
9%
10% Input:
11% m: array of size (n_1+1)x...x(n_d+1) holding the joint power moments
12% mu: vector of length d holding the means E[N_1],...,E[N_d]
13%
14% Output:
15% mc: array of the same size as m holding the joint central moments
16%
17% Example:
18% mc = moment_joint_central_from_raw_mean(m, [1.5, 2.5]);
19%
20% Reference:
21% A. Heindl and A. van de Liefvoort. Moment conversions for discrete
22% distributions. PMCCS, 2003, Section 4.
23
24sz = moment_tensorsize(m);
25d = numel(sz);
26if numel(mu) ~= d
27 line_error(mfilename,'The mean vector mu must have one entry per dimension of m.');
28end
29mc = m;
30for mode = 1:d
31 n = sz(mode)-1;
32 T = zeros(n+1,n+1);
33 for i = 0:n
34 for k = 0:i
35 T(i+1,k+1) = nchoosek(i,k) * (-mu(mode))^(i-k);
36 end
37 end
38 mc = moment_tensortrans(mc, T, mode);
39end
40end