变量- ARIMA Forcas
Forcast
6x1double
变量-ARIMA Predict
ARMA Predict
36x1double
代码如下:
r=[14.94 14.22 12.19 10.78 10.53 11.25 11.95 13.71 14.43 14.61 13.62 13.76 12.93 12.22 12.92 12.94 12.84 12.10 14.94 17.33 21.02 29.43 30.78 31.40 33.19 35.13 34.60 32.82 28.65 31.54 36.17 37.87 36.07 31.42 30.48 33.57];
tr=r';
data=tr;
step=6;
TempData=data;
output=data;
TempData=detrend(TempData);
TrendData=data-TempData;
[H,PValue,TestStat,CriticalValue]=adftest(TempData);
difftime=0;
SaveDiffData=[];
whileH=0)
SaveDiffData=[SaveDiffData,TempData(1,1)];
TempData=diff(TempData); difftime=difftime+1;
[H,PValue,TestStat,CriticalValue]=adftest(TempData);
end
test=[];
for p=0:5
for q=0:5
if(p+q
m=armax(TempData,[p q]);
AIC=aic(m);
test=[test;p q AIC];
end
end
end
for k=1:size(test,1)
if test(k,3)==min(test(:,3))
p_test=test(k,1);
q_test=test(k,2);
break;
end
end
m=armax(TempData,[p_test q_test]);
ARIMA_Predict=predict(m,TempData,step);
ARIMA_Forcast=forecast(m,TempData,step);
PreR=[ARIMA_Predict 'ARIMA_Forcast'];错误使用 horzcat要串联的数组的维度不一致。