ARMA(2)模型的RELS參數估計

%*****ARMA(2,2)*******
clear;
clc;
close all;
N=2000;n=2;lamda=0.998;
rand('seed',10);
e=0.6*randn(1,N+1);%a(t)
a=-[-1.7000    0.7200];%poly([0.8 0.9])
d=[-0.3 0.02];
y(1)=e(1);
y(2)=a(1)*y(1)+e(2)+d(1)*e(1);

for t=3:N+1
    y(t)=a(1)*y(t-1)+a(2)*y(t-2)+e(t)+d(1)*e(t-1)+d(2)*e(t-2);
end

sita(:,2)=zeros(2*n,1);
P(:,:,2)=10^5*eye(2*n);
ee(1)=y(1);
fai(:,2)=[y(1) 0 ee(1) 0];
for t=2:N
    ee(t)=y(t)-fai(:,t)'*sita(:,t-1);
    fai(:,t+1)=[y(t) y(t-1) ee(t) ee(t-1)]';%add '
    sita(:,t+1)=sita(:,t)+P(:,:,t)*fai(:,t+1)/(lamda+fai(:,t+1)'*P(:,:,t)*fai(:,t+1))*...
        [y(t+1)-fai(:,t+1)'*sita(:,t)];
    P(:,:,t+1)=1/lamda*(P(:,:,t)-P(:,:,t)*fai(:,t+1)/(lamda+fai(:,t+1)'*P(:,:,t)*fai(:,t+1))*...
        fai(:,t+1)'*P(:,:,t));
end

ee(1)=y(1);
taoe(1)=ee(1)^2;
for t=2:N
    ee(t)=y(t)-fai(:,t)'*sita(:,t-1);
    taoe(t)=taoe(t-1)+1/t*[ee(t)^2-taoe(t-1)];
end
   

t=1:N;
subplot(3,2,1);
plot(t,sita(1,t),'r');
line([0,N],[a(1),a(1)])
title('a1');
subplot(3,2,2);
plot(t,sita(2,t),'r');
line([0,N],[a(2),a(2)])
axis([0 N -5 5]);
title('a2');
subplot(3,2,3);
plot(t,sita(3,t),'r');
line([0,N],[d(1),d(1)])
title('d1');
subplot(3,2,4);
plot(t,sita(4,t),'r');
line([0,N],[d(2),d(2)])
axis([0 N -1 1]);
title('d2');
subplot(3,2,5);
plot(t,taoe,'r');
line([0,N],[0.36,0.36])
axis([0 N 0 2]);
title('taoe');

具體參數的解釋請參照之前的博客哦!

AR(3)模型的遞推最小二參數估計程序:

https://blog.csdn.net/ZC_lianshuang/article/details/90700956

CAR(2)模型的最小二參數估計的MATALB實現:

https://blog.csdn.net/ZC_lianshuang/article/details/90705524

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章