資源簡介
ARMA 模型(Auto-Regressive and Moving Average Model)是研究時間序列的重要方法,由自回歸模型(簡稱AR模型)與滑動平均模型(簡稱MA模型)為基礎“混合”構成。在市場研究中常用于長期追蹤資料的研究,如:Panel研究中,用于消費行為模式變遷研究;在零售研究中,用于具有季節變動特征的銷售量、市場規模的預測等。

代碼片段和文件信息
%Wilson?Palmeiro@Copyright.?This?exercise?has?got?real?data.?Because?we
%want?to?test?in?market.?Finally?we?test?for?500?days.?WE?can?assume?any
%finantial?asset.
dy=price2ret(imf(1:)‘continuous‘);%Differenciate?data
N=length(dy);
[PartialACF?lags?bounds]=parcorr(dy[][]2);%Analyze?PACF
[ACF?lags?bounds]=autocorr(dy[][]1.96);%Analyze?ACF?in?order?to?choose?the?order?of?model
figure()
subplot(221)
plot(dy)
subplot(222)
autocorr(dy)
subplot(223)
parcorr(dy)
subplot(224)
plot(Open);
[hpQstat?crit]=lbqtest(dy‘lags‘?[51015213036]);
model=arima(111)%At?this?time?we?will?use?the?mean?level
fit=estimate(modeldy)%to?predict.
[Y?YMSE]=forecast(fit500‘Y0‘dy)%It磗?more?commom?in?market?using
Price=ret2price(Y[1833.32000000000]1[]‘Periodic‘)%At?this?level?i?put?one?of?prices
Lower=Y-1.96*sqrt(YMSE);%GARCH??to?predict?volatility.
Upper=Y+1.96*sqrt(YMSE);
figure(2)
plot(dy‘Color‘[.7.7.7]);
hold?on
h1=plot(N+500:N+500Lower‘r‘‘LineWidth‘2);
plot(N+500:N+500Upper‘r‘‘LineWidth‘2);
h2=plot(N+500:N+500Y‘k‘‘LineWidth‘2);
legend([h1?h2]?‘95%?Interval‘?‘Forecast‘‘Location‘‘NorthWest‘)
title(‘Forecast?Using?ARMA?Model‘)
hold?off
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1212??2017-07-05?16:19??ARMA.m
- 上一篇:MATLAB控制系統復頻域分析
- 下一篇:MATLAB概率與數理統計分析第2版源代碼
評論
共有 條評論