|
Chapter Contents |
Previous |
Next |
| Time Series Analysis and Control Examples |
The nonstationary SSM is simulated to analyze the diffuse Kalman filter call KALDFF. The transition equation is generated using the following formula:
![[ z_{1t} \
z_{2t}
] =
[ 1.5 & -0.5 \
1.0 & 0.0
]
[ z_{1t-1} \
z_{2t-1}
] +
[ \eta_{1t} \
0
]](images/i10eq302.gif)
proc iml;
z_1 = 0; z_2 = 0;
do i = 1 to 30;
z = 1.5*z_1 - .5*z_2 + rannor(1234567);
z_2 = z_1;
z_1 = z;
x = z + .8*rannor(1234578);
if ( i > 10 ) then y = y // x;
end;
The KALDFF and KALCVF calls produce one-step prediction,
and the result shows that two predictions coincide
after the fifth observation (Output 10.4.1).
t = nrow(y);
h = { 1 0 };
f = { 1.5 -.5, 1 0 };
rt = .64;
vt = diag({1 0});
ny = nrow(h);
nz = ncol(h);
nb = nz;
nd = nz;
a = j(nz,1,0);
b = j(ny,1,0);
int = j(ny+nz,nb,0);
coef = f // h;
var = ( vt || j(nz,ny,0) ) //
( j(ny,nz,0) || rt );
intd = j(nz+nb,1,0);
coefd = i(nz) // j(nb,nd,0);
at = j(t*nz,nd+1,0);
mt = j(t*nz,nz,0);
qt = j(t*(nd+1),nd+1,0);
n0 = -1;
call kaldff(kaldff_p,dvpred,initial,s2,y,0,int,
coef,var,intd,coefd,n0,at,mt,qt);
call kalcvf(kalcvf_p,vpred,filt,vfilt,y,0,a,f,b,h,var);
print kalcvf_p kaldff_p;
Output 10.4.1: Diffuse Kalman Filtering
The likelihood function for the diffuse Kalman filter under the
finite initial covariance matrix
is written
![\lambda(y) = -\frac{1}2[y^\char93 \log(\hat{\sigma}^2)
+ \sum_{t=1}^T \log(|{D}_t|)]](images/i10eq305.gif)
d = 0;
do i = 1 to t;
dt = h*mt[(i-1)*nz+1:i*nz,]*h` + rt;
d = d + log(det(dt));
end;
s = qt[(t-1)*(nd+1)+1:t*(nd+1)-1,1:nd];
log_l = -(t*log(s2) + d)/2;
dff_logl = log_l - log(det(s))/2;
print log_l dff_logl;
Output 10.4.2: Diffuse Likelihood Function
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.