FM2-matlab代写
时间:2022-12-13

MATLAB FM2
Derivative Data Analysis (PART04)
(Phase II: modelling, estimation & diagnostic
Phase III: forecasting)
1
Estimation:
Model Selections:
Diagnostics:
MODEL: what should be included in the models???
 Stylized facts: Sharing non-trivial statistical properties
 Such properties, common across a wide range of financial instruments
3
Rama Cont, Empirical properties of asset
returns: Stylized facts and statistical
issues, Quantitative Finance, 1 (2001), pp.
1–14.
Model should included all Stylized facts
1. Heavy tails: the (unconditional) distribution of returns seems to
display a power-law or Pareto-like tail, with a tail index which is finite,
higher than two and less than five for most data sets studied. In
particular this excludes stable laws with infinite variance and the normal
distribution. However the precise form of the tails is difficult to
determine.
2. Volatility clustering: different measures of volatility display a
positive autocorrelation over several days, which quantifies the fact that
high-volatility events tend to cluster in time.
3. Slow decay of autocorrelation in absolute returns: the
autocorrelation function of absolute returns decays slowly as a function
of the time lag, roughly as a power law with an exponent . This is
sometimes interpreted as a sign of long-range dependence.
4. Leverage effect: most measures of volatility of an asset are
negatively correlated with the returns of that asset.
4
Rama Cont, Empirical properties of asset returns: Stylized facts and
statistical issues, Quantitative Finance, 1 (2001), pp. 1–14.
not more than 20 words in a slide!!!
5Return assumption: normally distributed
Return assumption: student-t distribution
MODELS for Return
6MODELS for Return
7
8Estimations
9%Data analysis for U.S. equity from 1990 to 2001
clear;clc;
format compact;
load Data_EquityIdx;
priceNYSE=DataTable.NYSE;
returnNYSE=price2ret(priceNYSE);
T=length(returnNYSE)
%LBQtest: Serial correlation. ARMA model needed for return series?
[h,p,Qstat,ChiCrit]=lbqtest(returnNYSE,'lags',[5,10,15])
10
%Estimation modelA: AR(1) NORMAL
modelA=arima('ARlags',1)
ESTmodelA=estimate(modelA,returnNYSE)
%Estimation modelB: AR(1) student-T
modelB=arima('ARlags',1,'distribution','t')
ESTmodelB=estimate(modelB,returnNYSE)
11
%Estimation modelC: ARMA(1,1) normal
modelC=arima('MAlags',1,'ARlags',1)
ESTmodelC=estimate(modelC,returnNYSE)
%Estimation modelD: ARMA(1,1) student-T
modelD=arima('MAlags',1,'ARlags',1,'distribution','t')
ESTmodelD=estimate(modelD,returnNYSE)
12
Model selections using information criteria
13
%MODEL SELECTION using AIC and BIC
[res0A,v0A,logL0A]=infer(ESTmodelA,returnNYSE);
[res0B,v0B,logL0B]=infer(ESTmodelB,returnNYSE);
[res0C,v0C,logL0C]=infer(ESTmodelC,returnNYSE);
[res0D,v0D,logL0D]=infer(ESTmodelD,returnNYSE);
[aic, bic]=aicbic([logL0A,logL0B,logL0C,logL0D],[2,3,3,4],T)
Estimation:
Return – ARMA
Model Selections:
AIC
BIC
Diagnostics:
Return: serial correlation?
t t tz = ~ . . . (0,1)tz i i d N
Example: return with GARCH(1,1) normal model
t tR =
Diagnostic
t tR residual= =
Residual:
Standardized residual:
16
%DIAGNOSE using LBQ-test
stdres0A=res0A./sqrt(v0A);
stdres0B=res0B./sqrt(v0B);
stdres0C=res0C./sqrt(v0C);
stdres0D=res0D./sqrt(v0D);
%LBQ TEST: return still have serial correlation?
disp('model0A')
[h, p, Qstat, Crit]=lbqtest(stdres0A,'Lags',[5,10,15])
disp('model0B')
[h, p, Qstat, Crit]=lbqtest(stdres0B,'Lags',[5,10,15])
disp('model0C')
[h, p, Qstat, Crit]=lbqtest(stdres0C,'Lags',[5,10,15])
disp('model0D')
[h, p, Qstat, Crit]=lbqtest(stdres0D,'Lags',[5,10,15])
model0A
1×3 logical array
1 1 1
p =
0.0305 0.0093 0.0012
Qstat =
12.3322 23.4340 37.1900
Crit =
11.0705 18.3070 24.9958
model0B
h =
1×3 logical array
1 1 1
p =
0.0120 0.0031 0.0004
Qstat =
14.6483 26.5302 40.1324
Crit =
11.0705 18.3070 24.9958
model0C
h =
1×3 logical array
0 1 1
p =
0.0576 0.0162 0.0021
Qstat =
10.7007 21.7842 35.5140
Crit =
11.0705 18.3070 24.9958
model0D
h =
1×3 logical array
1 1 1
p =
0.0279 0.0068 0.0009
Qstat =
12.5587 24.3292 37.8967
Crit =
11.0705 18.3070 24.9958
17
18
One-period ahead forecast:
Forecasting
Source: http://www.ams.sunysb.edu
19
Two-periods ahead forecast:
Source: http://www.ams.sunysb.edu
20
Source: http://www.ams.sunysb.edu
21
Matlab: Forecasting
MATLAB function: hold on, hold off, infer( ), forecast ( )
Forecast the return for 100-day-ahead
23
%FORECASTING
load Data_EquityIdx
nyse = DataTable.NYSE;
r = price2ret(nyse);
N = length(r);
%Estimation modelA: AR(1) NORMAL
modelA=arima('ARlags',[1])
ESTmodelA=estimate(modelA,r)
[E0,V0] = infer(ESTmodelA,r);
%95% interval forecasts
[Y,YMSE,V] = forecast(ESTmodelA,100,r,'E0',E0,'V0',V0);
upper = Y + 1.96*sqrt(YMSE);
lower = Y - 1.96*sqrt(YMSE);
figure
plot(r)
hold on
plot(N+1:N+100,Y,'r','LineWidth',2)
plot(N+1:N+100,[upper,lower],'k--')
xlim([0,N+100])
title('Forecasted Returns')
hold off
24
Does AR,MA, ARMA suitable?
1. ACF and PACF
2. Serial correlation test
Identify AR,MA, ARMA
1. ACF and PACF
Estimation:
Return – ARMA
Model Selections:
AIC
BIC
Diagnostics:
Return: serial correlation?
27
Box-Jenkins Procedures
Forecasting:
Return series
28

essay、essay代写