楼主: 黄山一绝
11206 7

求matlab编写的ARIMA程序 [推广有奖]

  • 0关注
  • 1粉丝

大专生

1%

还不是VIP/贵宾

-

威望
0
论坛币
2976 个
通用积分
0
学术水平
5 点
热心指数
0 点
信用等级
0 点
经验
609 点
帖子
31
精华
0
在线时间
40 小时
注册时间
2007-12-1
最后登录
2020-4-1

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
求matlab编写的ARIMA程序
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:MATLAB matla atlab ARIMA Rim MATLAB 程序 ARIMA 编写

沙发
yangjing2006 发表于 2009-12-5 15:58:51 |只看作者 |坛友微信交流群
用sas可以啊。。。而且到处都有代码。。很简单。。楼主可以考虑一下哦。。

使用道具

藤椅
wxj00921 发表于 2009-12-22 12:29:07 |只看作者 |坛友微信交流群
function [mbest,minaic,pbest,qbest]=armabat(x,pvec,qvec)
%
%   [mbest,minaic,pbest,qbest]=armabat(x,pvec,qvec)
%
% This functions computes ARMA  (p,q) models for
% (p,q) in (pvec x qvec ); it returns the best according to AIC
% where AIC has been modified to account for fixed parameters
%
% x = input data
% pvec = vector of p's ; set pvec=[0] for no AR
% qvec = vector of q's; set qvec=0[] for no MA
% mbest = matlab model structure for the best one found using the matlab aic
%         the model parameters can be retreived from mbest
% minaic = value of the aic at the min
% pbest = best value of p found
% qbest = best value of q found

% now estimate ARMA model; ARMAX is AX=BU + Ce so identify phi with A and theta with C
nx=length(x);
np=length(pvec);
nq=length(qvec);
aicsave=-99*ones(np,nq);
fpesave=-99*ones(np,nq);
minaic=1e+6;
for pp=1:np
    p=pvec(pp);
    for qq=1:nq
        q=qvec(qq);
        if p+q ~=0
            orders=[p q];
            m=armax(x,orders);      % m is a structure with the model stuff in it
            resids=pe(m,x);         % pe returns the prediction errors
            nres=length(resids);
            rhores=acf(resids,1); % this returns the acf normalized by the variance
            nrho=length(rhores);  
            % next compute the Ljung - Box statistic and P-values
            deltak=floor(nrho/10)+1;
            kvec=[p+q+1:deltak:p+q+1+4*deltak];
            for kk=1:5
                Qsum=0;
                for j=2:kvec(kk)+1
                    Qsum=Qsum+(rhores(j).^2)/(nx-j);
                end
                Qsum=nx*(nx-1)*Qsum;
                ljpv(kk)=1-chi2cdf(Qsum,kvec(kk)-p-q);  % df=kvec(kk)-p-q
            end
            aicsave(pp,qq)=aic(m);
            fpesave(pp,qq)=fpe(m);
            AICTEST=1;
            if AICTEST
                nval = m.EstimationInfo.DataLength;
                vval = m.EstimationInfo.LossFcn;
                totalpars=m.na+m.nc;
                netpars=totalpars-length(m.fix);
                aicval=log(vval)+2*netpars/nval;
                disp(sprintf('AIC : %g  NEWAIC : %g',aicsave(pp,qq),aicval));
            end
            if aicsave(pp,qq) < minaic
                minaic=aicsave(pp,qq); % save the min
                pbest=p;
                qbest=q;
                mbest=m;
            end
            disp(sprintf('(p,q)=(%d,%d) aic=%g  fpe=%g',p,q,aicsave(pp,qq),fpesave(pp,qq)));
            QQ=[kvec;ljpv];
            disp(sprintf('Ljung-Box P-values : '));
            disp(sprintf('  K=%d P-v=%6.3e \n',QQ(:)));

        end
    end
end

使用道具

板凳
Roccoon 发表于 2010-3-3 12:40:30 |只看作者 |坛友微信交流群
m=armax(x,orders);      % m is a structure with the model stuff in it
            resids=pe(m,x);         % pe returns the prediction errors

??
还是未明

使用道具

报纸
wywyongwei 发表于 2013-8-10 12:05:56 |只看作者 |坛友微信交流群
谢谢楼上的朋友,程序可以 编译

使用道具

地板
忆痕夕year 发表于 2013-8-31 00:42:45 |只看作者 |坛友微信交流群
clc,clear
a=[ ];
r11=autocorr(a);
r12=parcorr(a);
da=diff(a);
r21=autocorr(da);
r22=parcorr(da);
n=length(da);
for i=0:3
for j=0:3
spec=garchset('R',i,'M',j,'Display','off');
[coeffX,errorsX,LLFX]=garchfit(spec,da);
num=garchcount(coeffX);
[aic,bic]=aicbic(LLFX,num,n);
fprintf('R=%d,M=%d,AIC=%f,BIC=%f\n',i,j,aic,bic);
end
end
r=input('R=');
m=input('M=');
spec2=garchset('R',r,'M',m,'Display','off');
[coeffX,errorsX,LLFX]=garchfit(spec2,da);
[sigmaForecast,w_Forecast]=garchpred(coeffX,da,10)
x_pred=a(end)+cumsum(w_Forecast)

使用道具

7
matlab-007 发表于 2015-2-7 20:04:39 |只看作者 |坛友微信交流群
ARIMA预测MATLAB程序http://download.csdn.net/detail/singlefrog/2693756

使用道具

8
no7line 发表于 2018-6-14 13:36:55 |只看作者 |坛友微信交流群
忆痕夕year 发表于 2013-8-31 00:42
clc,clear
a=[ ];
r11=autocorr(a);
大佬,2014版garchest不能用了怎么办

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 17:29