State Space Model with Lagged State (SSMwLS) in the measurement equation
This repo contains accompanying code to the paper "A note on low-dimensional Kalman smoothers for systems with lagged states in the measurement equation" (Kurz, 2018).
Measurement Equation
State Equation
Malte S. Kurz
ARMA(1,1)-process with measurement error as State Space Model with Lagged State (SSMwLS) in the measurement equation
Example taken from Section 5 of Kurz (2018): "Application: ARMA dynamics with measurement error"
nObs = 5000; % number of observations
phi = 0.9; % AR(1)-parameter
theta = 0.5; % MA(1)-parameter
sigma_eps = 1; % standard-deviation of the signal-disturbance
q = 1.5; % signal-to-noise ratio
sigma_delta = sigma_eps / sqrt(q); % standard-deviation of the measurement error
A = phi;
C = [sigma_eps, 0];
R = [0, sigma_delta];
D1 = 1;
D2 = theta;
[dimObs, dimState, dimDisturbance] = checkDimsModifiedSSM(D1, D2, A, C, R);
Z = nan(nObs, dimObs);
X = nan(nObs, dimState);
[a_0_0, P_0_0] = initializeSSM(A, C, dimState);
X(1,:) = mvnrnd(a_0_0, P_0_0);
u = randn(nObs, dimDisturbance);
for iObs = 1:nObs
X(iObs+1, :) = A * X(iObs,:)' + C * u(iObs,:)';
Z(iObs, :) = D1 * X(iObs+1,:)' + D2 * X(iObs,:)' + R * u(iObs,:)';
end
[~, resStructFilter] = modifiedFilter(Z, D1, D2, A, C, R);
% Modified Anderson and Moore (1979) smoother (Eq. (4.3) in Kurz (2018))
resStruct_AM_Smoother = modifiedAndersonMooreSmoother(D1, D2, A, ...
resStructFilter.Z_tilde, resStructFilter.Finv, resStructFilter.K, resStructFilter.a_t_t, resStructFilter.P_t_t);
% Modified de Jong (1988, 1989) and Kohn and Ansley (1989) smoother (Eq. (4.11) in Kurz (2018))
resStruct_JKA_Smoother = modifiedDeJongKohnAnsleySmoother(D1, D2, A, ...
resStructFilter.Z_tilde, resStructFilter.Finv, resStructFilter.K, resStructFilter.a_t_t, resStructFilter.P_t_t);
% Modified Koopman (1993) smoother (Eq. (4.14)-(4.15) in Kurz (2018))
resStruct_K_Smoother = modifiedKoopmanSmoother(D1, D2, A, C, R, ...
resStructFilter.Z_tilde, resStructFilter.Finv, resStructFilter.K);
% Nimark's (2015) smoother
resStructNimarkSmoother = nimarkSmoother(D1, D2, A, ...
resStructFilter.Finv, resStructFilter.U, resStructFilter.K, resStructFilter.a_t_t, resStructFilter.P_t_t, resStructFilter.P_tp1_t);
fprintf(['Modified Anderson and Moore (1979) smoother vs. Modified de Jong (1988, 1989) and Kohn and Ansley (1989) smoother:\n',...
'Max norm of difference: ', num2str(max(max(resStruct_AM_Smoother.a_t_T - resStruct_JKA_Smoother.a_t_T))), '\n\n']);
fprintf(['Modified Anderson and Moore (1979) smoother vs. Modified Koopman (1993) smoother:\n',...
'Max norm of difference: ', num2str(max(max(resStruct_AM_Smoother.a_t_T - resStruct_K_Smoother.a_t_T))), '\n\n']);
fprintf(['Modified de Jong (1988, 1989) and Kohn and Ansley (1989) smoother vs. Nimark''s (2015) smoother:\n',...
'Max norm of difference: ', num2str(max(max(resStruct_JKA_Smoother.a_t_T - resStructNimarkSmoother.a_t_T))), '\n\n']);
Modified Anderson and Moore (1979) smoother vs. Modified de Jong (1988, 1989) and Kohn and Ansley (1989) smoother:
Max norm of difference: 8.8818e-16
Modified Anderson and Moore (1979) smoother vs. Modified Koopman (1993) smoother:
Max norm of difference: 3.5527e-15
Modified de Jong (1988, 1989) and Kohn and Ansley (1989) smoother vs. Nimark's (2015) smoother:
Max norm of difference: 0.35082