91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2021-04-17
  • 語言: Matlab
  • 標簽: ARMA模??白噪聲??

資源簡介

時間序列ARMA建模實例,包含對數據的平穩性檢驗、白噪聲檢驗及依據ARMA模型的預測。

資源截圖

代碼片段和文件信息

?Load_Data_Path=‘Trade_Data.txt‘;
%?Load_Data_Path=‘Industrial_Data.txt‘;
Predict_Num=16;
Test_Num=58-Predict_Num;

?[YearPrice_in]=textread(Load_Data_Path‘%s%f‘‘headerlines‘1);
%?[Price_in]=textread(Load_Data_Path‘%f‘‘headerlines‘1);
Price=Price_in(1:Test_Num);
l=1;
n=1:(Test_Num-l);
figure(1)
?subplot(311);
plot(Price_in);
?subplot(312);
?autocorr(Price_in(:)20)
?subplot(313);
?parcorr(Price_in(:)20)

[h1pvalue1]=lbqtest(Price[510152025]0.05)
[h2pvalue2]=adftest(Price‘alpha‘0.05‘model‘‘TS‘‘Lags‘0:6)

%?????Price1=log(Price)
%??????subplot(312);
%??plot(nPrice1(:));

%??Price_diffl=diff(Pricel)
%?[hpvalue]=adftest(Price_diff‘alpha‘0.05‘model‘‘TS‘‘Lags‘0:6)
?Price_lg=log(Price);
??Price_diffl=diff(Price_lgl);
?if?l==2
?????Price_diffl_1=diff(Price_lgl-1);
?end
%?????Price_diffl_2=diff(Price_lgl-2);
??
?[h3pvalue3]=adftest(Price_diffl‘alpha‘0.05‘model‘‘TS‘‘Lags‘0:6)
figure(2)
?subplot(311);
?plot(nPrice_diffl(:));
?subplot(312);
?autocorr(Price_diffl(:)20)
?subplot(313);
?parcorr(Price_diffl(:)20)

?%確定階數
?AIC=10^4;
?for?i=0:3
?????for?j=0:6
?????????Spec=garchset(‘R‘i‘M‘j‘Display‘‘off‘);
?????????[EstSpecEstSElogL]=garchfit(SpecPrice_diffl);
?????????Num=garchcount(EstSpec);
?????????[aic(i+1j+1)bic(i+1j+1)]=aicbic(logLNumlength(Price_diffl));
?????????if?AIC>aic(i+1j+1)
?????????????AIC=aic(i+1j+1);
?????????????p=i;
?????????????q=j;
?????????end
?????end
?end

?%模型參數估計
?Spec_Model=garchset(‘R‘p‘M‘q‘Display‘‘off‘);
?[EstSpecEstSElogLesigmasummary]=garchfit(SpecPrice_diffl);
?
?%求預報值
[sigmaForecastDiff_Forecast]=garchpred(EstSpecPrice_difflPredict_Num);
%?Price_diffl_F1=cumsum(Diff_Forecast)+Diff_Forecast(1);
%?n1=[Diff_Forecast(1)];
%?Price_diffl_F2=[n1;Price_diffl_F1];
if?l==1
????Price_diffl_F=exp(Price_lg(Test_Num)+cumsum(Diff_Forecast));

end???
if?l==2?
Price_diffl_F=exp(Price_lg(Test_Num)+cumsum(Price_diffl_1(Test_Num-1)+cumsum(Diff_Forecast)));
end
%??Price_diffl_F=exp(Price_lg(Test_Num)+(Price_diffl_1(Test_Num-2)+cumsum(Price_diffl_2(Test_Num-1)+cumsum(Diff_Forecast))));

?
%??
%?Price_lg1=log(Price_in);
%???Price_diff1=diff(Price_lg1l);
%?n1=1:58-l;
%?n2=Test_Num+1:58;
%?figure(2);
%?plot(n1?Price_diff1);
%?hold?on;
%?plot(n2Diff_Forecast‘r‘);
[abcde]=regress(Diff_ForecastPrice_diffl(Test_Num-l-Predict_Num+1:Test_Num-l));
[h4pvalue4]=lbqtest(c[123456]0.05)


n1=1:58;
n2=Test_Num+1:58;
figure(3);
plot(n1Price_in);
hold?on;
plot(n2Price_diffl_F‘r‘);
x=[‘ARMA模型的階數為AR(‘num2str(p)‘)MA(‘num2str(q)‘)‘];
y=[‘原始數據白噪聲檢驗的結果為:‘num2str(h1)‘原始數據平穩性檢驗的結果為‘num2str(h2)‘處理后數據平穩性檢驗的結果為‘num2str(h3)‘殘差序列白噪聲檢驗的結果為:‘num2str(h4)];
%?disp(?x)
msgbox(x);
msgbox(y);


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2896??2014-03-22?12:20??Time_Series_1.m
?????文件?????????740??2013-04-12?08:27??Trade_Data.txt

評論

共有 條評論