jungsee的个人博客分享 http://blog.sciencenet.cn/u/jungsee

博文

面板向量自回归模型pvar

已有 28849 次阅读 2015-1-29 17:48 |个人分类:STATA|系统分类:科研笔记

首先是程序下载:

pvar_old.zip

pvar2014.zip


Inessa Love
Associate Professor
Economics Department
University of Hawaii at Manoa


http://econ.worldbank.org/WBSITE/EXTERNAL/EXTDEC/EXTRESEARCH/0,,contentMDK:22677911~pagePK:64214825~piPK:64214943~theSitePK:469382,00.html

Panel VAR (vector autoregression)
Authors:Inessa Love
Report Number:WPS2913
Citation: 

“Financial Development and Dynamic Investment Behavior: evidence from Panel VAR” (Inessa Love with Lea Ziccino), The Quarterly Review of Economics and Finance, 46 (2006), 190-210.

There are notes up front in the main program file pvar.ado explaining how to use these programs. There might be remaining bugs in the codes and they are not 100% error-proof.  Please contact I. Love c/o research@worldbank.org if you find errors.

If you do end up using these programs for a paper, please acknowledge that you did so in the front-page footnote and please also use the citation above.

If you do end up using these programs, please send a copy of your work, when it is done, to I. Love c/o research@worldbank.org.


Access to Dataset


新的代码:

https://sites.google.com/a/hawaii.edu/inessalove/home/research

New in this version:
- updated to Stata 12
- uses built-in Stata's gmm program that allows for expanded functionality (eg. clustered errors, choice of the weighting matrix)
- added sub-routines for lag selection and granger causality
- can add exogenous variables
- new graphing capabilities compatible with Stata's var package
- see help files for details.
- use README.do to see how the PVAR package compares with Stata's build-in VAR package.


/* NOTE

This example uses follows that in theofficial Stata suite of time-series VAR packages

estimated using the beta panel VAR suite.

*/

 

webuse lutkepohl2, clear

 genid = 1

 

xtset id qtr

global var dln_inv dln_inc dln_consump

 

* Lag-order selection

varsoc $var

pvarsoc $var

 

* VAR estimation

var  $var

estimates store estvar

pvar2 $var, fod lags(2)

estimates store estpvar

estimates table estvar estpvar, se

 

* VAR stability      

estimates restore estvar

varstable, graph

estimates restore   estpvar

pvarstable, graph

 

* Granger-causality

vargranger, est(estvar)  

pvargranger, est(estpvar)

 

* IRF estimation

estimates restore estvar

tempname irfv irfvset

  irf create `irfv', step(10) set(`irfvset', replace)

 irfgraph oirf, byopts(yrescale)

 

pvarirf, oirf porder($var) iter(100) dotsstep(10)




人大经济论坛的帖子:

http://bbs.pinggu.org/thread-1361544-1-1.html


http://bbs.pinggu.org/thread-1070293-1-1.html

love 编写的 pvar 命令无法直接计算 AIC 和 BIC,但可以利用她的程序计算出的返回值计算这些统计量。相关的统计量的计算方法参见连玉君(2009,中国上市公司投资效率研究,经济管理出版社,第4章)。在“stata学术论文视频教程”(http://baoming.pinggu.org/Default.aspx?id=134)中,我follow了Love(2006)的文章,并修改了pvar程序,命名为 pvar2。改程序的主要改进如下:
*------------------------------------
*-1.3  pvar2命令: 连玉君更新后的程序
*------------------------------------
 
 *---------------                
 *-1.3.1 主要改进
 
       help pvar2   // see Section: `What is new?'
       
       *-(1)  tsset
       *-(2)  helm 内化
       *-(3)  timeeffect 内化
       *-(4)  irf(#)  irfformat()
       *-(5)  decomp(#)
       *-(6)  AIC, BIC, HQIC (滞后阶数选择依据)
       *      估计结果可以用 est store 存储,并进而用 esttab 输出
       *-(7)  nograph, saving() 选项
       *      设定 irf() 选项后,MC 后产生的 CI 数据会自动存储在 irf_data.dta 文件中
       *      若附加 nograph 选项, 则只采用 MC 获得 IRF 数据,不输出图形
       *-(8)  Granger 因果检验  
       
       *-高级应用: 可以自行修改改程序(建议另存后修改)
         doedit "path\adofiles\pvar2.ado"  //ado      doedit"path\adofiles\pvar2.hlp"  //打开 帮助文件


*--------------------------
*-1.3.3 PVAR 滞后阶数的选择
 

pvar2 kstock invest mvalue, lag(5) soc

===========================================
 Selection Order Criteria for Panel VAR  
===========================================
 +------------------------------------+
 |lag |    AIC       BIC      HQIC    |
 |----+-------------------------------|
 |  1 |  37.8491   38.5409   38.1296  |
 |  2 |  34.3367   35.2221   34.6959  |
 |  3 |  33.7112   34.8067    34.156  |
 |  4 |  33.0443*   34.369*  33.5825* |
 |  5 |  33.9323   35.5082   34.5727  |
 +------------------------------------+

*-判断规则:
* (1) 选择 AIC, BIC 或 HQIC 值最小的模型;
* (2) 但三者不一致时, BIC/HQIC 倾向于选择比较精简的模型,
*     AIC 倾向于选择比较"丰满"的模型,
*     通常,BIC/HQIC 优于 AIC.
* (3) 有时也不能完全依赖上述准则, 需要做一些人为判断
* (4) 计算公式: pp.56  Eq.(4-31)-Eq.(4-33)
   shellout "$pathRefs连玉君_PhD_chp4_Panel_VAR.pdf" // 博士论文第四章


*-------------------------
*-1.3.6  Granger 因果检验
 
 
pvar2 kstock invest mvalue, lag(3) granger

=============================
  Granger Causality tests  
=============================

  Granger causality Wald tests for Panel VAR
 +------------------------------------------------------------------+
 |          Equation           Excluded |   chi2     df Prob > chi2 |
 |--------------------------------------+---------------------------|
 |          h_kstock           h_invest |  52.221     3    0.000    |
 |          h_kstock           h_mvalue |  9.0752     3    0.028    |
 |          h_kstock                ALL |  118.88     6    0.000    |
 |--------------------------------------+---------------------------|
 |          h_invest           h_kstock |  15.613     3    0.001    |
 |          h_invest           h_mvalue |  12.366     3    0.006    |
 |          h_invest                ALL |  18.998     6    0.004    |
 |--------------------------------------+---------------------------|
 |          h_mvalue           h_kstock |   15.08     3    0.002    |
 |          h_mvalue           h_invest |  2.7232     3    0.436    |
 |          h_mvalue                ALL |  25.034     6    0.000    |
 +------------------------------------------------------------------+
 
*-检验过程解析: invest 是否为 kstock 的 Granger 因?
  local Eq "h_kstock"   // 方程名称
  local v  "h_invest"
  test [`Eq']L.`v' = [`Eq']L2.`v' = [`Eq']L3.`v' = 0

*-Notes:
* 执行 Granger 因果检验时,可以不必拘泥于 xtvarsoc 选出的滞后阶数;
* 因为 Granger 因果检验的目的在于检验 x 滞后项对 y 的联合影响


至于第二个问题,即是否需要平稳性检验。
我认为,VAR 模型都需要实现进行平稳性检验。有的文章之所以没有进行平稳性检验,例如 Love (2006) 是因为她分析的都是公司财务变量,这些变量一定是平稳的,根本无需进行单位根检验。但当研究区域经济增长时,就需要进行检验了。


http://www.statalist.org/forums/forum/general-stata-discussion/general/188610-concerning-panel-var-pvar-ado

Concerning Panel VAR (pvar.ado)
Hello all,

I'm have some quaestions about the pvar.ado package. It has been introduced by Inessa Love but before I turn to her I was wondering if some of you know solutions to my problems
Browsing the Internet resp. Statalist was not successful.

To come up with my dataset: I have a long balanced Panel (N=4, T=23) with yearly data, four endogenous variables and want to estimate a 1-lag PVAR.

Now my questions:

1) Everytime I use the monte [#] option to generate impulse response functions with error bands, they are indeed produced, but in an "old" graph format and not the common "live" format.
Is there a way to convert the graph files into live format? Furthermore the graphs for the IRF's are not given in one big 4x4 stacked graph which would be better for graphical analysis. So I want to use the "graph combine" command which does not work for the old graph format.
(Even this link did not help: http://www.ats.ucla.edu/stat/stata/faq/graphics78.htm)

Furthermore I get the error message "option t1() incorrectly specified". I cannot find any reason why.

2) Why do I have to time-demean the variables (as recommended in the help-file) before using the "helm" command for forward-demeaning? This just doesn't make sense to me.

3) Maybe I did not understand the PVAR approach sufficiently, but why do we have to use lagged dependant variables (t-2) as instruments for the t-1 rhs-variables? The problem of the fixed effects in dynamic regression analysis should be solved with the forward-demeaning using "helm" shouldn't it? Couldn't we just use the variables in levels as in a normal VAR after eliminating the fixed effects?

Thank you very much in advance!

Tim Grünebaum







https://wap.sciencenet.cn/blog-793574-863837.html

上一篇:学者——Frank Schorfheide
下一篇:Stata 13 windows + OS 系统 32位/64位可升级版 下载
收藏 IP: 111.203.16.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-29 12:02

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部