function arma=armaa(x)
clc
GG=load('d:/gr.txt');
KK=GG;
GG=dtrend(GG);
aic=autocorr(GG);%自相关
paic=parcorr(GG);%偏相关
mm=-aic;
nn=-paic;
paic(1)=[];
aic(1)=[];
nn(1)=1;
for i=2:13,
for
j=1:i,
dd(j)=nn(j);
end
c=filter(dd,1,GG);
for
op=1:i-1,
c(op)=[];
end
canca(i-1)=var(c);
end
for i=1:12,
BIC(i)=log(canca(i))+1/length(KK)*log(length(KK));
AIC(i)=log(canca(i))+2*i/length(KK);
end
aic
paic
canca
%残差平方和
AIC
BIC
输出结果:
aic =
-0.5037
0.1220
-0.2108
0.0796
0.0187
0.1169
-0.2162
0.2517
-0.1932
0.0559
-0.1036
0.0123
0.2180
-0.0591
-0.1431
0.0697
-0.0505
0.0115
0.0312
-0.0766
paic =
-0.5041
-0.1781
-0.3551
-0.2831
-0.1772
0.0360
-0.2209
0.1458
0.0688
0.0009
-0.1723
-0.2912
0.1872
0.1437
-0.2386
0.1059
0.2155
-0.3839
-0.2884
-0.2151
canca =
1.0e+003 *
Columns 1 through 11
2.5172
2.4685
2.3110
2.2903
2.3482
2.3340
2.2696
2.2007
1.9902
2.0228
2.1040
Column 12
2.1688
AIC =
Columns 1 through 11
7.8660
7.8815
7.8507
7.8768
7.9368
7.9659
7.9730
7.9772
7.9118
7.9631
8.0376
Column 12
8.1030
BIC =
Columns 1 through 11
7.9019
7.8823
7.8164
7.8074
7.8323
7.8263
7.7983
7.7675
7.6669
7.6832
7.7225
Column 12
7.7529
对于acf和pacf,跟EVIEWS输出结果一样。
http://s16/middle/6e95187dh9da925d1721f&690
加载中,请稍候......