LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
JMomsFromJFactorialMoms.m
1% jm = JMomsFromJFactorialMoms(jfm)
2%
3% Returns the lag-1 joint raw moments given the lag-1 joint
4% factorial moments.
5%
6% The lag-1 joint raw moments are:
7% `m_{i,j}=E(\mathcal{X}^i\mathcal{Y}^j)`
8%
9% The factorial moments are:
10% `f_{ij}=E(\mathcal{X}(\mathcal{X}-1)\cdots(\mathcal{X}-i+1)\mathcal{Y}(\mathcal{Y}-1)\cdots(\mathcal{Y}-j+1))`
11%
12% Parameters
13% ----------
14% jfm : matrix, shape (M,M)
15% The matrix of joint factorial moments. The entry in
16% row i and column j is `f_{i,j},i\geq 1,j\geq 1`.
17%
18% Returns
19% -------
20% jm : matrix, shape (M,M)
21% The matrix of joint raw moments. The entry in row i
22% and column j is `m_{i,j},i\geq 1,j\geq 1`.
23%
24% References
25% ----------
26% http://en.wikipedia.org/wiki/Factorial_moment
27
28function jmoms=JMomsFromJFactorialMoms(jfmoms)
29
30 s1=size(jfmoms,1);
31 s2=size(jfmoms,2);
32
33 jmoms=zeros(s1,s2);
34 for i=1:s1
35 for j=1:s2
36 xCoeff=poly(0:i-1);
37 xCoeff=xCoeff(end-1:-1:1);
38 yCoeff=poly(0:j-1);
39 yCoeff=yCoeff(end-1:-1:1);
40 eh=-xCoeff'*yCoeff;
41 jmoms(i,j)=jfmoms(i,j)+trace(jmoms(1:i,1:j)*eh');
42 end
43 end
44end