全部版块 我的主页
论坛 金融投资论坛 六区 金融学(理论版) 金融工程(数量金融)与金融衍生品
3918 14
2014-10-31
根据蔡瑞胸老师《金融数据分析导论》第177页到178页NGARCH模型的代码,用日经225和恒生指数的日数据估算模型的参数。参数估计出来后,各种指标都非常好。
但是,导出波动率后,发现波动率非常大,普遍在100%左右,最高的甚至700%。请问有没有人知道这是怎么回事啊?
二维码

扫码加我 拉你入群

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

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

全部回复
2014-11-1 07:05:50
Can you provide more details? Thanks
二维码

扫码加我 拉你入群

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

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

2014-11-3 09:04:00
Chemist_MZ 发表于 2014-11-1 07:05
Can you provide more details? Thanks
"Ngarch" <- function(rtn){
# Estimation of a non-symmertic GARCH, NGARCH(1,1), model.
# Assume normal innovations
# rtn: return series
#
# The likelihood function "glkn" can be modified to fit more general NGARCH
#  models.
write(rtn,file='tmp.txt',ncol=1)
# obtain initial estimates
mu=mean(rtn)
par=c(mu,0.01,0.8,0.01,0.7)
#
#
mm=optim(par,glkn,method="Nelder-Mead",hessian=T)
low=c(-10,0,0,0,0)
upp=c(10,1,1,0.4,2)
#mm=optim(par,glkn,method="L-BFGS-B",hessian=T,lower=low,upper=upp)
## Print the results
par=mm$par
H=mm$hessian
Hi = solve(H)
cat(" ","\n")
cat("Estimation results of NGARCH(1,1) model:","\n")
cat("estimates: ",par,"\n")
se=sqrt(diag(Hi))
cat("std.errors: ",se,"\n")
tra=par/se
cat("t-ratio: ",tra,"\n")
# compute the volatility series and residuals
ht=var(rtn)
T=length(rtn)
if(T > 40)ht=var(rtn[1:40])
at=rtn-par[1]
for (i in 2:T){
sig2t=par[2]+par[3]*ht[i-1]+par[4]*(at[i-1]-par[5]*sqrt(ht[i-1]))^2
ht=c(ht,sig2t)
}
sigma.t=sqrt(ht)
Ngarch <- list(residuals=at,volatility=sigma.t)
}

glkn <- function(par){
rtn=read.table("tmp.txt")[,1]
glkn=0
ht=var(rtn)
T=length(rtn)
if(T > 40)ht=var(rtn[1:40])
at=rtn[1]-par[1]
for (i in 2:T){
ept=rtn-par[1]
at=c(at,ept)
sig2t=par[2]+par[3]*ht[i-1]+par[4]*ht[i-1]*(at[i-1]/sqrt(ht[i-1])-par[5])^2
ht=c(ht,sig2t)
glkn=glkn + 0.5*(log(sig2t) + ept^2/sig2t)
}
glkn
}
二维码

扫码加我 拉你入群

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

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

2014-11-3 09:14:42
Chemist_MZ 发表于 2014-11-1 07:05
Can you provide more details? Thanks
nikkeigarchvol.txt
大小:(22.92 KB)

 马上下载

data.zip
大小:(79.03 KB)

 马上下载

本附件包括:

  • hangsenggarchvol.txt
  • nikkei.csv
  • nikkeigarchvol.txt
  • hangseng.csv

hangsenggarchvol.txt
大小:(23.54 KB)

 马上下载


这里是附件
二维码

扫码加我 拉你入群

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

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

2014-11-3 10:30:30
xuenesta 发表于 2014-11-3 09:14
这里是附件
Looks no big problem in the code. I don't use R so I can't run it. Can you provide the estimation results?
二维码

扫码加我 拉你入群

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

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

2014-11-4 09:23:16
Chemist_MZ 发表于 2014-11-3 10:30
Looks no big problem in the code. I don't use R so I can't run it. Can you provide the estimation  ...
日经的garch的vol在nikkeigarchvol中,实际波动在zip中nikkei文件中的classic parkison yangandzhang三栏是三种
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群