1function [fit] = m3pp2m_fitc_theoretical(mmap, method, t, tinf)
2% Fits the theoretical characteristics of a
MMAP(n,m) with a M3PP(2,m).
4% - mmap: the
MMAP(n,m) to fit with a M3PP(2,m)
5% - method:
'exact_delta',
'approx_delta',
'approx_cov' or
'approx_ag'
6% - t: (optional) finite time scale
7% - tinf: (optional) near-infinite time scale
10 method =
'approx_delta';
15if strcmp(method,
'approx_cov') && m > 2
16 error(
'Approximate covariance fitting only supported for two classes.');
30% joint-process charactersitics
31a = map_count_mean(mmap,t1)/t1;
32bt1 = map_count_var(mmap,t1)/(a*t1);
33bt2 = map_count_var(mmap,t2)/(a*t2);
34binf = map_count_var(mmap,tinf)/(a*tinf);
35mt2 = map_count_moment(mmap,t2,1:3);
36m3t2 = mt2(3) - 3*mt2(2)*mt2(1) + 2*mt2(1)^3;
39ai = mmap_count_mean(mmap,1);
41if strcmp(method,
'exact_delta') == 1 || strcmp(method,
'approx_delta') == 1
42 % per-
class variance difference
45 mmap2 = {mmap{1},mmap{2},mmap{2+i},mmap{2}-mmap{2+i}};
46 Vt3 = mmap_count_var(mmap2,t3);
47 dvt3(i) = Vt3(1)-Vt3(2);
51if strcmp(method,
'exact_delta') == 1
52 fit = m3pp2m_fitc(a, bt1, bt2, binf, m3t2, t1, t2, ai, dvt3, t3);
53elseif strcmp(method,
'approx_delta') == 1
54 fit = m3pp2m_fitc_approx(a, bt1, bt2, binf, m3t2, t1, t2, ai, dvt3, t3);
55elseif strcmp(method,
'approx_cov') == 1
56 vi = mmap_count_var(mmap,t3);
57 s = 0.5 * (map_count_var(mmap,t3) - sum(vi));
58 fit = m3pp22_fitc_approx_cov(a, bt1, bt2, binf, m3t2, t1, t2, ai, s, t3);
59elseif strcmp(method,
'approx_ag') == 1
62 mmap2 = {mmap{1},mmap{2},mmap{2+i},mmap{2}-mmap{2+i}};
63 v2t3 = mmap_count_var(mmap2,t3);
64 s2t3 = mmap_count_mcov(mmap2,t3);
65 gt3(i) = v2t3(1) + s2t3(1,2);
67 fit = m3pp2m_fitc_approx_ag(a, bt1, bt2, binf, m3t2, t1, t2, ai, gt3, t3);
69 error(
'Invalid method ''%s\''', method);