全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 EViews专版
5257 8
2008-12-29
<p>如题</p><p>跪求eviews的var模型应用详解</p>
二维码

扫码加我 拉你入群

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

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

全部回复
2008-12-29 20:34:00

建议看E-views的安装程序example file中VAR部分的介绍,比如里面有Blanquad关于SVAR的例子和程序,同时结合help文件的介绍可以完全理解这个模型,可以在程序中应用如下程序:

' Blanchard-Quah long-run restriction (11/5/99)
' verify estimates using three methods
' last checked 4/1/2004

' include subroutine
include sub_rmaxdiff.prg

'change path to program path
%path = @runpath
cd %path

' create workfile
wfcreate blanquah q 1948:1 1987:4

' fetch data from database (already demeaned)
fetch(d=data_svar) dy u

' estimate VAR (no constant)
var var1.ls 1 8 dy u @

'-------------------------------------------------------------------
' method 1: text form long-run restrictions
'-------------------------------------------------------------------

var1.cleartext(svar)
var1.append(svar) @lr1(@u1)=0

freeze(tab1) var1.svar(rtype=text,conv=1e-4)
show tab1

' store estimated A and B matrices from method 1
matrix mata1 = var1.@svaramat ' A should be identity
matrix matb1 = var1.@svarbmat

'-------------------------------------------------------------------
' method 2: long-run restrictions in short-run form
' *not recommended; only for checking*
'-------------------------------------------------------------------

' get unit (cumulated) long-run response
var1.impulse(imp=u)
matrix clr = var1.@lrrsp

var1.cleartext(svar)
var1.append(svar) @e1 = c(1)*@u1 + c(2)*@u2
var1.append(svar) @e2 = -clr(1,1)*c(1)/clr(1,2)*@u1 + c(4)*@u2

freeze(tab2) var1.svar(rtype=text,conv=1e-5)
show tab2

' store estimated A and B matrices from method 2
matrix mata2 = var1.@svaramat ' A should be identity
matrix matb2 = var1.@svarbmat

'-------------------------------------------------------------------
' method 3: moment matching (used in Blanchard-Quah (1989) paper)
' *only works for just-identified models*
'-------------------------------------------------------------------

' get residual covariance
sym rcov = var1.@residcov
' and do cholesky factorization
matrix chol = @cholesky(rcov)

' factorize unit long-run response
matrix p = clr * chol

' factorized B matrix
matrix(2,2) q
' impose sign normalization by taking positive root
q(1,1) = @sqrt( 1/(1+p(1,1)*p(1,1)/p(1,2)/p(1,2)) )
q(2,1) = -p(1,1)*q(1,1)/p(1,2)
q(1,2) = -q(2,1)
q(2,2) = q(1,1)

' get implied B matrix
matrix matb3 = chol * q

'-------------------------------------------------------------------
' check whether results match
'-------------------------------------------------------------------

' difference in A matrices
matrix eye2 = @identity(2) ' truth
scalar adiff1
call sub_rmaxdiff(mata1, eye2, adiff1)
scalar adiff2
call sub_rmaxdiff(mata2, eye2, adiff2)

' difference in B matrices
scalar bdiff13
call sub_rmaxdiff(matb1, matb3, bdiff13)
scalar bdiff23
call sub_rmaxdiff(matb2, matb3, bdiff23)

' display L-infinity norm of matrix difference in table
table(2,3) check
setcolwidth(check,1,10)
setcolwidth(check,2,15)
setcolwidth(check,3,15)

check(1,2) = "A - eye2"
check(1,3) = "B - method3"
check(2,1) = "method1:"
check(3,1) = "method2:"

check(2,2) = adiff1
check(3,2) = adiff2
check(2,3) = bdiff13
check(3,3) = bdiff23

show check

二维码

扫码加我 拉你入群

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

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

2008-12-31 16:00:00

看不懂

先谢谢这位大哥了

二维码

扫码加我 拉你入群

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

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

2008-12-31 19:30:00
楼主可以看看张晓峒的那本书,虽然不算很详细但是也还可以了。
二维码

扫码加我 拉你入群

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

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

2009-1-1 12:14:00
论坛里有张晓彤的免费下载,你可以看看  很详细的,而且很容易懂
二维码

扫码加我 拉你入群

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

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

2009-1-1 14:13:00
我哪个帖子里面有
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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