全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 EViews专版
6414 11
2013-10-19
我是完全按照自带的例子改动的(见下),改动的地方用红色标出,运行程序时出现“Missing values in @LOGL series at current coefficients at observation 1 in “DO_BVGARCH.ML(SHOWOPTS,M=100,C=1E-5)”的提示,求高手解答~~
这是程序:
' BV_GARCH.PRG (3/30/2004)
' Revised for 6.0 (3/7/2007)
' example program for EViews LogL object
'
' restricted version of
' bi-variate BEKK of Engle and Kroner (1995):
'
'  y = mu + res
'  res ~ N(0,H)
'
'  H = omega*omega' + beta H(-1) beta' + alpha res(-1) res(-1)' alpha'
'
' where
'
'     y = 2 x 1
'     mu = 2 x 1
'      H = 2 x 2 (symmetric)
'          H(1,1) = variance of y1   (saved as var_y1)
'          H(1,2) = cov of y1 and y2 (saved as var_y2)
'          H(2,2) = variance of y2   (saved as cov_y1y2)
'  omega = 2 x 2 low triangular
'   beta = 2 x 2 diagonal
'  alpha = 2 x 2 diagonal
'
'change path to program path
%path = @runpath
cd %path
' load workfile
load  "F:\EVIEWS\ART\LK.wf1"
' dependent variables of both series must be continues
smpl @all
series y1 = dlog(szzs)
series y2 = dlog(nsdk)

' set sample
' first observation of s1 need to be one or two periods after
' the first observation of s0
sample s0 11/16/2011 10/18/2013
sample s1 11/16/2011 10/18/2013


' initialization of parameters and starting values
' change below only to change the specification of model
smpl s0
'get starting values from univariate GARCH
equation eq1.arch(m=100,c=1e-5) y1 c
equation eq2.arch(m=100,c=1e-5) y2 c
' declare coef vectors to use in bi-variate GARCH model
' see above for details
coef(2) mu
mu(1) = eq1.c(1)
mu(2)= eq2.c(1)
coef(3) omega
omega(1)=(eq1.c(2))^.5
omega(2)=0
omega(3)=eq2.c(2)^.5
coef(2) alpha
alpha(1) = (eq1.c(3))^.5
alpha(2) = (eq2.c(3))^.5
coef(2) beta
beta(1)= (eq1.c(4))^.5
beta(2)= (eq2.c(4))^.5
' constant adjustment for log likelihood
!mlog2pi = 2*log(2*@acos(-1))
' use var-cov of sample in "s1" as starting value of variance-covariance matrix
series cov_y1y2 = @cov(y1-mu(1), y2-mu(2))
series var_y1 = @var(y1)
series var_y2 = @var(y2)
series sqres1 = (y1-mu(1))^2
series sqres2 = (y2-mu(2))^2
series res1res2 = (y1-mu(1))*(y2-mu(2))

' ...........................................................
' LOG LIKELIHOOD
' set up the likelihood
' 1) open a new blank likelihood object (L.O.) name bvgarch
' 2) specify the log likelihood model by append
' ...........................................................
logl bvgarch
bvgarch.append @logl logl
bvgarch.append sqres1 = (y1-mu(1))^2
bvgarch.append sqres2 = (y2-mu(2))^2
bvgarch.append res1res2 = (y1-mu(1))*(y2-mu(2))
' calculate the variance and covariance series
bvgarch.append var_y1  =  omega(1)^2 + beta(1)^2*var_y1(-1) + alpha(1)^2*sqres1(-1)
bvgarch.append var_y2  = omega(3)^2+omega(2)^2 + beta(2)^2*var_y2(-1) + alpha(2)^2*sqres2(-1)
bvgarch.append cov_y1y2 = omega(1)*omega(2) + beta(2)*beta(1)*cov_y1y2(-1) + alpha(2)*alpha(1)*res1res2(-1)
' determinant of the variance-covariance matrix
bvgarch.append deth = var_y1*var_y2 - cov_y1y2^2
' inverse elements of the variance-covariance matrix
bvgarch.append invh1 = var_y2/deth
bvgarch.append invh3 = var_y1/deth
bvgarch.append invh2 = -cov_y1y2/deth
' log-likelihood series
bvgarch.append logl =-0.5*(!mlog2pi + (invh1*sqres1+2*invh2*res1res2+invh3*sqres2) + log(deth))
' remove some of the intermediary series
' bvgarch.append @temp invh1 invh2 invh3 sqres1 sqres2 res1res2 deth

' estimate the model
smpl s1
bvgarch.ml(showopts, m=100, c=1e-5)
' change below to display different output
show bvgarch.output
graph varcov.line var_y1 var_y2 cov_y1y2
show varcov
' LR statistic for univariate versus bivariate model
scalar lr = -2*( eq1.@logl + eq2.@logl - bvgarch.@logl )
scalar lr_pval = 1 - @cchisq(lr,1)

二维码

扫码加我 拉你入群

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

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

全部回复
2013-10-19 22:32:42
源program你用的哪个?
二维码

扫码加我 拉你入群

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

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

2013-10-19 22:42:02
zhangibt 发表于 2013-10-19 22:32
源program你用的哪个?
BV_GARCH 这个
二维码

扫码加我 拉你入群

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

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

2013-10-19 23:29:12
看了源程序, path不对。 你若真想改,就把LK.wf1移动到你这个程序的相同目录里。
然后那一句直接用load LK
或者把上面的@runpath改成工作文件夹的路径。
二维码

扫码加我 拉你入群

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

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

2013-10-20 10:04:17
zhangibt 发表于 2013-10-19 23:29
看了源程序, path不对。 你若真想改,就把LK.wf1移动到你这个程序的相同目录里。
然后那一句直接用load L ...
你好,请问具体如何操作呢? 另LOAD WORKFILE 下面 的LOAD“。。。”必须要是完整的路径,直接LK.wf1不行,试了一下。
二维码

扫码加我 拉你入群

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

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

2013-10-20 11:31:23
把lk.wf1和你这个程序放在一个文件夹下,然后用下面的:

%path = @runpath
cd %path
' load workfile
load  lk
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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