arch garch 区别pred和arch garch 区别sim的区别

苹果/安卓/wp
积分 9, 距离下一级还需 1 积分
道具: 彩虹炫, 涂鸦板, 雷达卡, 热点灯下一级可获得
道具: 金钱卡
购买后可立即获得
权限: 隐身
道具: 金钱卡, 彩虹炫, 雷达卡, 热点灯, 涂鸦板
难过签到天数: 2 天连续签到: 1 天[LV.1]初来乍到
老师是专攻realized garch的金融计量老师··· 课后要求我们用matlab实现realized garch··· 请问realized garch到底和garch模型有什么区别,然后function code和garch有什么区别吗?
附 garch funciton code:
function [param,outs] = garch11_m(r10y,r3m)
%% optimization
options = optimset('Algorithm','interior-point','Display','iter');
%param0 = [0.1;0.15;0.75;0.1;0.8;0;1];
param0 = [0.;0.95;-0.305;0.95;-0.59;1]; %local minnum
A = [0,1,1,0,0,0,0];
lb = [0,0,0,-inf,-inf,-inf,-inf]';
ub = [inf,1,1,inf,inf,inf,inf];
[param,ll,exitflag,~,~,grad,hessen] = fmincon(@neglogl,param0,A,b,[],[],lb,ub,[],options,r10y,r3m);
if nargout == 2
& & outs.cov = inv(hessen);
& & outs.exitflag =
& & outs.ll = -
& & outs.grad = -
& & outs.hessen = -
& & alpha0 = param(1);
& & alpha1 = param(2);
& & beta1 = param(3);
& & gamma0 = param(4);
& & gamma1 = param(5);
& & phi = param(6);
& & rho = param(7);
& & n = length(r10y);
& & sigma = zeros(n,1);
& & mu = zeros(n,1);
& & for t = 2:n
& && &&&sigma(t) = alpha0 + alpha1*mu(t-1) + beta1*sigma(t-1);
& && &&&mu(t) = gamma0 + gamma1*r3m(t) + phi*sigma(t)^(rho/2);
& & outs.mu =
& & outs.sigma =
%% define the objective function
function ll = neglogl(param,r10y,r3m)
alpha0 = param(1);
alpha1 = param(2);
beta1 = param(3);
gamma0 = param(4);
gamma1 = param(5);
phi = param(6);
rho = param(7);
n = length(r10y);
sigma = zeros(n,1);
mu = zeros(n,1);
mu(1) = r10y(1);
for t = 2:n
& & sigma(t) = alpha0 + alpha1*mu(t-1) + beta1*sigma(t-1);
& & mu(t) = gamma0 + gamma1*r3m(t) + phi*sigma(t)^(rho/2);
ll = -mean(log(pdf('norm',r10y(2:end),mu(2:end),sqrt(sigma(2:end)))));
支持楼主:、
购买后,论坛将把您花费的资金全部奖励给楼主,以表示您对TA发好贴的支持
载入中......
老师是ZHUO HUANG??
请问realized garch的程序问题解决了吗?是用基于分布来进行估计的呢?程序可否共享一下呢,谢谢!!
请问LZ&&realized garch问题解决了吗,最近做作业也需要这东西,烦请LZ分享一下~
中级学术勋章
中级学术勋章
中级热心勋章
中级热心勋章
中级信用勋章
中级信用勋章
高级学术勋章
高级学术勋章
高级热心勋章
高级热心勋章
高级信用勋章
高级信用勋章
初级学术勋章
初级学术勋章
初级热心勋章
初级热心勋章
初级信用勋章
初级信用勋章
无限扩大经管职场人脉圈!每天抽选10位免费名额,现在就扫& 论坛VIP& 贵宾会员& 可免费加入
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
如有投资本站或合作意向,请联系(010-);
邮箱:service@pinggu.org
投诉或不良信息处理:(010-)
京ICP证090565号
论坛法律顾问:王进律师 上传我的文档
 下载
 收藏
该文档贡献者很忙,什么也没留下。
 下载此文档
正在努力加载中...
第7章、arch模型和garch模型
下载积分:900
内容提示:第7章、arch模型和garch模型
文档格式:DOC|
浏览次数:2|
上传日期: 10:54:07|
文档星级:
全文阅读已结束,如果下载本文需要使用
 900 积分
下载此文档
该用户还上传了这些文档
第7章、arch模型和garch模型
官方公共微信>> garchsim.m
garchsim.m ( File view )
function [e , h , y] = garchsim(spec, nSamples, nPaths, seed, X)
%GARCHSIM Univariate GARCH process simulation.
Given specifications for the conditional mean and variance of a univariate
time series, simulate sample paths for the return series, innovations, and
conditional standard deviation processes. Each of NUMPATHS sample paths are
sampled at NUMSAMPLES observations. The conditional mean may be of general
ARMAX form and conditional variance of general GARCH form.
[Innovations, Sigma, Series] = garchsim(Spec)
[Innovations, Sigma, Series] = garchsim(Spec, NumSamples, NumPaths, Seed, X)
Optional Inputs: NumSamples, NumPaths, Seed, X
Spec - Structure specification for the conditional mean and variance
models. Spec is a MATLAB structure with fields generated by calling the
function GARCHSET. Type &help garchset& for details.
% Optional Inputs:
NumSamples - Positive integer indicating the number of samples generated for
each path of Innovations, Sigma, and Series outputs. If empty or missing,
the default is 100.
NumPaths - Positive integer indicating the number of sample paths
(realizations) generated for the Innovations, Sigma, and Series outputs.
If empty or missing, the default is 1.
Seed - Scalar random number generator seed. If empty or missing, default
is 0 (the MATLAB initial state).
X - Time series regression matrix of explanatory variable(s). Typically, X
is a regression matrix of asset returns (e.g., the return series of an
equity index). Each column of X is an individual time series used as an
explanatory variable in the regression component of the conditional mean.
In each column of X, the first row contains the oldest observation and
the last row the most recent. If empty or missing, the conditional mean
will have no regression component. If specified, then at least the most
recent NUMSAMPLES observations of each return series must be valid (i.e.,
non-NaN). When the number of valid observations in each series exceeds
NUMSAMPLES, only the most recent NUMSAMPLES observations of X are used.
% Outputs:
Innovations - NUMSAMPLES by NUMPATHS matrix of innovations, representing a
mean zero, discrete-time stochastic process. The Innovations time series
follows the input conditional variance (GARCH) specification. Rows are
sequential times samples, columns are independent realizations.
Sigma - NUMSAMPLES by NUMPATHS matrix of conditional standard deviations
of the corresponding Innovations matrix. Innovations and Sigma are the
same size, and form a matching pair of matrices. Rows are sequential
times samples, columns are independent realizations.
Series - NUMSAMPLES by NUMPATHS matrix of the return series of interest.
Series is the dependent stochastic process and follows the input
conditional mean specification of general ARMAX form. Rows are
sequential times samples, columns are independent realizations.
% See also GARCHSET, GARCHGET, GARCHPRED, GARCHFIT.
% References:
Bollerslev, T. (1986), &Generalized Autoregressive Conditional
Heteroskedasticity&, Journal of Econometrics, vol. 31, pp. 307-327.
Box, G.E.P., Jenkins, G.M., Reinsel, G.C., &Time Series Analysis:
Forecasting and Control&, 3rd edition, Prentice Hall, 1994.
Engle, Robert (1982), &Autoregressive Conditional Heteroskedasticity
with Estimates of the Variance of United Kingdom Inflation&,
Econometrica, vol. 50, pp. 987-1007.
Hamilton, J.D., &Time Series Analysis&, Princeton University Press, 1994.
% Copyright
The MathWorks, Inc.
% $Revision: 1.8 $
13:45:34 $
% Check input parameters and set defaults.
if (nargin &= 2) & ~isempty(nSamples)
if prod(size(nSamples)) & 1
error(' Number of observations ''NumSamples'' must be a scalar.');
if (round(nSamples) ~= nSamples) | (nSamples &= 0)
error(' Number of observations ''NumSamples'' must be a positive integer.');
% Set default.
if (nargin &= 3) & ~isempty(nPaths)
if prod(size(nPaths)) & 1
error(' Number of sample paths ''NumPaths'' must be a scalar.');
if (round(nPaths) ~= nPaths) | (nPaths &= 0)
error(' Number of sample paths ''NumPaths'' must be a positive integer.');
% Set default.
if (nargin &= 4) & ~isempty(seed)
if prod(size(seed)) & 1
error(' Random number generator seed ''Seed'' must be a scalar.');
% Set default.
% Scrub the regression matrix and ensure sufficient observations exist.
% Note that, in contrast to estimation, simulation of the innovations
% process is independent of X. However, during estimation, the innovations
% process must be inferred from the conditional mean specification, which
% includes a regression component if desired.
if (nargin &= 5) & ~isempty(X) & (nargout &= 3)
if prod(size(X)) == length(X)
% Check for a vector.
% Convert to a column vector.
Retain the last contiguous block of non-NaN (i.e, non-missing valued) observations only.
if any(isnan(X(:)))
X((max(find(isnan(sum(X,2)))) + 1):end , :);
if size(X,1) & nSamples
error(' Regression matrix ''X'' has insufficient number of observations.');
Ensure number of regression coefficients match number of regressors.
garchget(spec , 'Regress'); % Conditional mean regression coefficients.
if size(X,2) ~= length(regress)
error(' Number of ''Regress'' coefficients unequal to number of regressors in ''X''.');
% Ensure X exists.
% Ensure all coefficients exist and have proper dimensions.
garchget(spec , 'R');
% Conditional mean AR order.
garchget(spec , 'M');
% Conditional mean MA order.
garchget(spec , 'P');
% Conditional variance order for lagged variances.
garchget(spec , 'Q');
% Conditional variance order for lagged squared residuals.
garchget(spec , 'C');
% Conditional mean constant.
garchget(spec , 'AR');
% Conditional mean AR coefficients.
garchget(spec , 'MA');
% Conditional mean MA coefficients.
garchget(spec , 'K');
% Conditional variance constant.
garchget(spec , 'GARCH');
% Conditional variance coefficients for lagged variances.
garchget(spec , 'ARCH');
% Conditional variance coefficients for lagged squared residuals.
if isempty(C)
error(' Conditional mean constant ''C'' must be specified.');
if isempty(AR) & (R ~= 0)
error(' Auto-regressive ''AR'' coefficients must be specified.');
if isempty(MA) & (M ~= 0)
error(' Moving-average ''MA'' coefficients must be specified.');
if isempty(K)
error(' Conditional variance constant ''K'' must be specified.');
if isempty(GARCH) & (P ~= 0)
error(' ''GARCH'' coefficients of lagged variances must be specified.');
if isempty(ARCH)
& (Q ~= 0)
error(' ''ARCH'' coefficients of lagged squared residuals must be specified.');
% ARMA(R,M)/GARCH(P,Q) processing requires pre-sample values for conditioning.
% Let y(t) = return series of interest (assumed stationary)
e(t) = innovations of the model noise process (assumed invertible)
h(t) = conditional variance of the innovations process e(t)
% We require R pre-sample lags of y(t), max(M,Q) pre-sample lags of e(t), and
% P pre-sample lags of h(t). To be safe, create max([R M P Q]) pre-sample lags
% for all processes in the ARMA(R,M)/GARCH(P,Q) model.
preSamples
max([R M P Q]);
% # of pre-sample lags needed to 'jump-start' the process.
% Estimate the number of samples it takes for the transients of the
% ARMA(R,M) and GARCH(P,Q) processes to die out, so the output processes
% are in (approximately) steady-state. The metric used is, granted, rather
% arbitrary: Estimate the number of samples needed for the magnitude of
% the impulse response (which begins at 1) to decay below 0.01 (i.e., 1%).
% The estimate is based on the magnitude of the largest eigenvalue of the
% auto-regressive polynomial. Note that a GARCH(P,Q) process for e(t)
% implies an ARMA(max(P,Q),P) process for e(t)^2.
if isempty(AR)
decayTime1
eigenValues =
roots([1 -AR]);
decayTime1
ceil(log(0.01) / log(max(abs(eigenValues)))) + M;
if isempty(ARCH) & isempty(GARCH)
decayTime2
zeros(max([P Q]) , 2);
AB(1:Q+1,1) =
-ARCH(:)];
AB(1:P+1,2) =
[1 ; -GARCH(:)];
polynomial
sum(AB(2:end,:),2);
eigenValues =
roots([1 ; polynomial]);
decayTime2
ceil(log(0.01) / log(max(abs(eigenValues)))) + P;
% Set the total number of samples generated for each path.
preSamples
max(decayTime1 , decayTime2);
% Get the probability distribution of the innovations process
% and draw the i.i.d. random sequence, v(t), that drives the
% e(t) innovations sequence such that e(t) = v(t)*sqrt(h(t)).
distribution
garchget(spec , 'Distribution');
distribution
distribution(~isspace(distribution));
switch upper(distribution)
case 'GAUSSIAN'
randn('state' , seed);
randn(T , nPaths);
% v(t) are i.i.d. Gaussian deviates ~ N(0,1) distributed.
error(' Distribution of innovations must be ''Gaussian''.')
% Estimate the unconditional standard deviation of the invertible e(t) process.
sqrt(K / (1 - sum([GARCH(:) ; ARCH(:)])));
% Construct the conditional variance parameter vector of length (1 + P + Q).
varianceCoeffici
(Not finished, please download and read the complete file)
Expand> <Close
Want complete source code? Download it here
0 lines left, continue to read ▼
Sponsored links
Tips: You can preview the content of files by clicking file names^_^
5.33 kB12-03-02 17:09
16.64 kB12-03-02 17:09
xyz.mat15.66 kB21-05-99 07:50
&garchdemos&0.00 B21-09-08 21:15
4.74 kB12-03-02 17:09
7.28 kB12-03-02 17:09
7.64 kB12-03-02 17:09
1.98 kB15-05-02 20:50
6.17 kB12-03-02 17:09
5.88 kB12-03-02 17:09
2.68 kB12-03-02 17:09
5.75 kB12-03-02 17:09
42.83 kB12-03-02 17:09
4.45 kB12-03-02 17:09
9.63 kB12-03-02 17:09
garchllfarmax.dll20.00 kB18-06-02 12:53
garchllfgarch.dll20.00 kB18-06-02 12:53
11.11 kB12-03-02 17:09
6.06 kB12-03-02 17:09
4.02 kB12-03-02 17:09
3.98 kB12-03-02 17:09
21.32 kB12-03-02 17:09
29.52 kB12-03-02 17:09
15.51 kB12-03-02 17:09
garchsimgarch.dll20.00 kB18-06-02 12:53
614.00 B05-03-02 21:51
4.24 kB12-03-02 17:09
7.87 kB12-03-02 17:09
6.56 kB12-03-02 17:09
8.52 kB12-03-02 17:09
6.12 kB12-03-02 17:09
6.98 kB12-03-02 17:09
712.00 B02-06-02 12:57
&ja&0.00 B21-09-08 21:15
&garch&0.00 B21-09-08 21:15
&garch&0.00 B21-09-08 21:15
Sponsored links
Sent successfully!
Your Point(s)
Your Point isn't enough.
Get point immediately by PayPal
10 Points / $20
22 Points / $40
55 Points / $100
120 Points / $200
point will be added to your account automatically after the transaction.
Don't have an account?
Need any help?
切换到中文版?
^_^"Oops ...
Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
Favorite by计量经济工具箱分析_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
计量经济工具箱分析
上传于|0|0|暂无简介
阅读已结束,如果下载本文需要使用1下载券
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩21页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢苹果/安卓/wp
积分 67, 距离下一级还需 18 积分
道具: 彩虹炫, 涂鸦板, 雷达卡, 热点灯, 金钱卡, 显身卡下一级可获得
权限: 自定义头衔
购买后可立即获得
权限: 隐身
道具: 金钱卡, 彩虹炫, 雷达卡, 热点灯, 涂鸦板
1、平稳性判定(只需要看序列图和自相关图即可),其用途体现在建模前,决定数据预处理步骤。
①、时间序列无明显的周期性或趋势性。(自相关图拖尾与缓慢下降有何联系与区别?)
if( ① ): ②、若自相关系数很快衰减到0,则序列平稳,同时随机性不强。(k阶截尾表示X(t)与X(t-k)含有一定的关系:短期自相关,k要尽可能小。)
& && && && && && &&&若自相关系数一开始便始终处于2倍标准差内波动,则序列平稳,同时具有较强随机性。
& && && && && && &&&若自相关系数长期为同一符号,则具有一定趋势性。
& && && && && && &&&若呈三角函数曲线变化,则有一定周期性。
2、对于纯随机性检验,常也可以使用ACF和PACF并观察图像获得,但两者均只考虑是否存在某一特定滞后阶数的相关。而LB检验是基于一些列滞后阶数,判断序列总体的相关性或者随机性是否存在。其用途体现在建模前和建模后,建模前是判断原始序列是否具有随机性,若随机则无法分析,若不随机则开始建模。建模后则是判断残差是否随机,对于方差齐性假设的ARIMA模型,如果残差随机则表示模型已提取全部相关组分,模型有效,若不随机则模型无效。
3、偏自相关系数是在AR(p)模型的介绍中引入的,是给定X(t-1),.....,X(t-k+1)的情况下,考察X(t)和X(t-k)的关系。AR(p)模型自相关系数拖尾,偏相关系数p阶截尾,都是由AR模型中引出。
4、通过2中的论述,引出了MA(q)模型自相关系数q阶截尾,偏自相关系数拖尾。(对MA模型还不是很理解,需要加强!尤其是可逆性的作用?)
5、AR(p)模型讲求平稳性,MA(q)模型讲求可逆性。ARMA(p,q)模型的平稳性由AR部分决定,可逆性由MA部分决定。
6、因为ARMA(p,q)自相关系数不截尾,其可以转化为无穷阶MA模型(传递形式),同时偏自相关系数不截尾,其可以转化为无穷阶AR模型(逆转形式)。因此,若自相关系数拖尾,偏自相关系数拖尾,则可以采用ARMA模型拟合。
7、ARIMA(p,d,q)模型是指d阶差分后自相关最高阶数为p,表示为自回归项(AR模型部分),移动平均项最高阶数为q的模型(MA模型部分)。
8、时序模型在分析之余,略有点套的嫌疑,尤其是自相关系数与偏相关系数均不太稳定时,疏系数ARIMA模型建模时尤其如此。正如回归分析采用枚举的方法找最大相关因子一样,目前所接触的统计方法中大抵如此。
9、在时序分析中,采用ACF和PACF指标对模型定阶并无统一标准,主观性成分巨多同时不好程序化。因此,目前多采用AIC、BIC等统计量对模型定阶。即,采用枚举的方法拟合所有模型,而后分别计算AIC,选取具有最小AIC的模型即可。
10、自相关系数与偏自相关系数2倍标准差的来历:从直观上,通过ACF和PACF定阶存在一定困难,不会理论上完美截尾。有理论证明,当样本容量n充分大时,样本自相关系数与样本偏自相关系数近似服从正态分布,因此有了2倍标准差范围的判断来历。(平稳序列建模 -& 模型识别)
11、个人认为无必要刻意去追求构建ARIMA模型,只需将差分后的序列视作一个时间序列,了解它的内涵,预测时有所注意即可。
12、方差齐性假设采用ARIMA模型,异方差则采用GARCH模型。但建模前后均要LB检验模型是否符合原假设。
13、GARCH建模流程。
first、《GeneralizedAutoregressive Conditional Heteroskedasticity》
second、《Matlab Garch Toolbox》
& & 13.1、首先利用Engle'sARCH test对ARCH效应进行检验,检验是否存在异方差,调用函数[H, pValue, ARCHstat, CriticalValue] = archtest (Residuals, Lags,Alpha)。如果H = 1,则说明存在异方差。当然,也可采用Ljung-Box Q统计量检验的方法(调用MATLAB函数lbqtest)。
& & 13.2、构建模型,分别调用garchset、garchfit等函数。其中garchset的VarianceModel可以考虑'GARCH'、'EGARCH'、'GJR'等,EGARCH模型采用了GED分布(GARCH采用正态分布),GJR模型在条件方差方程中加入负冲击的杠杆效应,但仍采用正态分布假设。
& & 13.3、模型预测和模拟,对应函数分别是garchpred、garchsim(模型模拟常用到的是Monte Carlo Simulation),garchpred得到的MeanForecast是预测值,garchsim得到的mean(Series_Sim,2)是模拟值。
& & 13.4、对GARCH、GJR等不同模型的效果进行评价,可以利用似然比检验(likelihood ratio test)、赤池信息准则(AIC)/贝叶斯信息准则(BIC)等进行,对应的函数分别为lratiotest、aicbic。
支持楼主:、
购买后,论坛将把您花费的资金全部奖励给楼主,以表示您对TA发好贴的支持
载入中......
总评分:&论坛币 + 116&
学术水平 + 8&
热心指数 + 7&
信用等级 + 5&
本帖被以下文库推荐
& |主题: 608, 订阅: 144
时间序列大部分都是在讲ARIMA,ARCH,GARCH,time trend,stationary and non-stationary。跟stochastic没关系。
我们学校的一个大神教授再过两年铁定以时间序列的研究获诺贝尔经济学奖,现在他的课卡的很严,一般人不让上,想选必须把所有数学相关课程的成绩单和书单email给他。但数学里也没对stochastic做要求,倒是对高级计量经济学有要求
个人建议学习时间序列分析最好看看随机过程的基础书籍,比如
应用随机过程教程 龚光鲁,钱敏平著
据说这本书是专门写给工科生的。然后里面包括了你想学的时间序列分析的基础内容。
时间序列分析嘛,结合计量软件比如R或者matlab来学还是比较科学的学习方法,在软件上实现的过程也是你加深对模型理解的过程。
切记:理论和软件,两手都要抓,两手都要硬。二者相辅相成,不能分割。
再给你推荐几本书:TSAY的《金融时间序列分析:基于R语言》中国人民大学出版社。另外一本Jonathan D. Cryer的《时间序列分析及应用:R语言》,机械工业出版社。这两本在国外普遍比较流行。
切记:以问题为导向,去做点实证分析,learning by doing。很快就会提高。
对于纯粹时间序列分析预测,目前最理想的方法应该就是RNN及其变体了。标准的RNN要达到好的效果会比较难训练,目前它的带记忆的变体,比如LSTM(long-short term memory)和GRU(gated recurrent unit)都非常热门。进一步的,这些模型还可以和其它神经网络模型组合,比如在LSTM下面堆叠若干层的CNN等等,这样基本上就是目前深度学习(deep learning)中常见的处理时间序列最好的模型了。当然这也要配置和训练得当才能得到好的效果(包括数据预处理、恰当的参数等)。
在时间序列分析中,评价一个时间序列预测模型的好坏,只看平均预测误差的都是耍流氓……个人感觉机器学习在时间序列上的效果有时候还不如传统的状态空间模型……
时间序列主要考虑的因素是:
长期趋势(Long-term trend)
时间序列可能相当稳定或随时间呈现某种趋势。
时间序列趋势一般为线性的(linear),二次方程式的 (quadratic)或指数函数(exponential function)。
季节性变动(Seasonal variation)
按时间变动,呈现重复性行为的序列。
季节性变动通常和日期或气候有关。
季节性变动通常和年周期有关。
周期性变动(Cyclical variation)
相对于季节性变动,时间序列可能经历“周期性变动”。
周期性变动通常是因为经济变动。
随机影响(Random effects)
garch模型正在用,非常感谢楼主,另外不知拟蒙特卡洛楼主是否有研究
太棒啦!!!!
您需要登录后才可以回帖
无限扩大经管职场人脉圈!每天抽选10位免费名额,现在就扫& 论坛VIP& 贵宾会员& 可免费加入
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
&nbsp&nbsp|
如有投资本站或合作意向,请联系(010-);
邮箱:service@pinggu.org
投诉或不良信息处理:(010-)
京ICP证090565号
论坛法律顾问:王进律师

我要回帖

更多关于 arch garch 区别 的文章

 

随机推荐