LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mtrace_joint.m
1function JM = mtrace_joint(T, A, i)
2% Given a multi-class trace, computes the empirical class-dependent joint
3% moments that estimate E[ ( X^(a)_j )^i(1) (X^(a)_(j+l) )^i(2) ]
4% for all classes a.
5%
6% Input:
7% T: the inter-event times
8% A: the class of each event
9% i: a vector specifying the power of each variable in the joint moment
10%
11% Output:
12% JM: the joint moment of each class
13
14% number of classes
15C = max(A);
16
17% number of events
18N = length(A);
19
20% result
21JM = zeros(C,1);
22
23for a = 1:C
24 % events of class a, excluding the first and last event
25 Ta = T(A(2:(N-1))==a);
26 % number of events of class a, excluding the first and last event
27 Na = length(Ta);
28 tmp = 0;
29 for j = 1:(N-2)
30 if A(j+1) == a
31 tmp = tmp + T(j)^i(1) * T(j+1)^i(2);
32 end
33 end
34 JM(a) = 1/Na * tmp;
35end
36
37end