Debian Codegraph @

tests/kalman_filter_smoother/testsmoother.m

raw
1 load test
2 % $$$ Y = Y(1:2,:);
3 % $$$ mf = mf(1:2);
4 % $$$ H=H(1:2,1:2);
5 % $$$ pp = pp-1;
6 % $$$ trend =trend(1:2,:);
7 Pinf1(1,1) = 1;
8 Pstar1(1,1) = 0;
9 Pstar1(4,1) = 0;
10 Pstar1(1,4) = 0;
11 [alphahat1,epsilonhat1,etahat1,a11, aK1] = DiffuseKalmanSmootherH1(T,R,Q,H, ...
12 Pinf1,Pstar1,Y,trend,pp,mm,smpl,mf);
13 [alphahat2,epsilonhat2,etahat2,a12, aK2] = DiffuseKalmanSmootherH3(T,R,Q,H, ...
14 Pinf1,Pstar1,Y,trend, ...
15 pp,mm,smpl,mf);
16 max(max(abs(alphahat1-alphahat2)))
17 max(max(abs(epsilonhat1-epsilonhat2)))
18 max(max(abs(etahat1-etahat2)))
19 max(max(abs(a11-a12)))
20 max(max(abs(aK1-aK2)))
21
22 return
23 [alphahat1,etahat1,a11, aK1] = DiffuseKalmanSmoother1(T,R,Q, ...
24 Pinf1,Pstar1,Y,trend,pp,mm,smpl,mf);
25 [alphahat2,etahat2,a12, aK2] = DiffuseKalmanSmoother3(T,R,Q, ...
26 Pinf1,Pstar1,Y,trend, ...
27 pp,mm,smpl,mf);
28
29
30 max(max(abs(alphahat1-alphahat2)))
31 max(max(abs(etahat1-etahat2)))
32 max(max(abs(a11-a12)))
33 %max(max(abs(aK1-aK2)))
34
35
36 H = zeros(size(H));
37 [alphahat1,etahat1,a11, aK1] = DiffuseKalmanSmoother1(T,R,Q, ...
38 Pinf1,Pstar1,Y,trend,pp,mm,smpl,mf);
39 [alphahat2,epsilonhat2,etahat2,a12, aK2] = DiffuseKalmanSmootherH1(T,R,Q,H, ...
40 Pinf1,Pstar1,Y,trend, ...
41 pp,mm,smpl,mf);
42 max(max(abs(alphahat1-alphahat2)))
43 max(max(abs(etahat1-etahat2)))
44 max(max(abs(a11-a12)))
45 %max(max(abs(aK1-aK2)))
46
47
48 [alphahat1,etahat1,a11, aK1] = DiffuseKalmanSmoother3(T,R,Q, ...
49 Pinf1,Pstar1,Y,trend,pp,mm,smpl,mf);
50 [alphahat2,epsilonhat2,etahat2,a12, aK2] = DiffuseKalmanSmootherH3(T,R,Q, H, ...
51 Pinf1,Pstar1,Y,trend,pp,mm,smpl,mf);
52
53 max(max(abs(alphahat1-alphahat2)))
54 max(max(abs(etahat1-etahat2)))
55 max(max(abs(a11-a12)))
56 %max(max(abs(aK1-aK2)))