當前位置:編程學習大全網 - 網站源碼 - 用matlab做arima時,有沒有什麽命令可以自動定階的

用matlab做arima時,有沒有什麽命令可以自動定階的

Matlab為ARIMA模型階數選擇提供了成熟的代碼方案,思路是利用貝葉斯信息量準則(bic),在matlab幫助中搜索“Choose ARMA Lags Using BIC”或參見官方文檔“.mathworks.com/help/econ/choose-arma-lags.html”。

代碼摘錄如下:

LogL = zeros(pMax,qMax);%pMax,qMax來自於自相關、偏自相關序列圖顯著階數最(較)大值

SumPQ = LogL;

for p = 1:pMax

for q = 1:qMax

Mdl = arima(p,0,q);

[fit,~,LogL(p,q)] = estimate(Mdl,X,'print',false);%X是待檢驗序列

SumPQ(p,q) = p+q;

end

end

logL = reshape(LogL,pMax*qMax,1);

numParams = reshape(SumPQ,pMax*qMax,1) + 1;

[~,bic] = aicbic(logL,numParams,500);

BIC = reshape(bic,pMax,qMax)

minBIC = min(bic)

[BICbestP,BICbestQ] = find(BIC == minBIC)

Mdl = arima(BICbestP,0,BICbestQ);

[fit,~,~] = estimate(Mdl,lnR,'print',false)

  • 上一篇:shanocr是什麽軟件
  • 下一篇:秒贊公益紙巾,是傳銷,是圈錢是騙人的嗎
  • copyright 2024編程學習大全網