楼主: snowshen
1888 10

[编程问题求助] 请求帮忙修改STATA程序 [推广有奖]

  • 0关注
  • 0粉丝

本科生

6%

还不是VIP/贵宾

-

威望
0
论坛币
1135 个
通用积分
0.0627
学术水平
1 点
热心指数
1 点
信用等级
1 点
经验
817 点
帖子
53
精华
0
在线时间
76 小时
注册时间
2008-3-27
最后登录
2016-7-31

100论坛币
我有一段STATA程序用来画impulse response的图, stata.jpg ,如图,我想把中间那条线画成实线,两边的线画成虚线 (也就是confidence interval)。请求帮助。STATA code如下:

capture program drop gr_imp
program define gr_imp

* can graph with errors and without errors

if "`1'"=="i"{local i "i"}   /* in case of Monte-Carlo `i'="i" */
  else local i ""            /* normal case `i'is a blank     */

set textsize 170

local g=1
while `g'<=$G {         /* row variable - the one that is recepient of respone */

  local j=1
  while `j'<=$G {      /* column variable - the one causing response */
     if "`i'"=="i" {   /* with errors */
       format ${name`j'}_5 ${name`j'} ${name`j'}_95 %7.4f
       gr ${name`j'}_5 ${name`j'} ${name`j'}_95 s if /* */ varname=="${name`g'}",saving(gr`g'_`j',replace) s(iii) c(lll) yli(0) /*                              
        */  b1("response of ${name`g'} to ${name`j'} shock")
        }
     else {             /* without errors */
        format ${name`j'} %7.4f
        gr ${name`j'} s if varname=="${name`g'}",saving(gr`g'_`j',replace) s(i) c(l) yli(0) /*                              
        */  b1("response of ${name`g'} to ${name`j'} shock")
        }
     local grlist "`grlist' gr`g'_`j'"   /* list of all graphs to put together */
     local j=`j'+1
   }
local g=`g'+1
}

set textsize 100
*if length("   Impulse-responses for $P lag VAR of $names ")>80 { set textsize 90}

if "`i'"=="i"{
   local b2="b2(Errors are 5% on each side generated by Monte-Carlo with $maxi reps)"}

if "$if"~="" { local t2="t2(Sample : $if)"}

if length("   Impulse-responses for $P lag VAR of $names ")<80 {
   gr using `grlist', t1(     Impulse-responses for $P lag VAR of $names ) `t2' `b2'
    }
else {
   gr using `grlist', t1( $P lag VAR of $names ) `t2' `b2'
   }
end
完整的程序请看, Panel VAR code.rar (182.98 KB) ,里面包括了运行所需要的.ado文件,运行命令,数据。主要用到的是pvar.ado文件,我想修改的也是这个文件。谢谢。




s1.jpg (20.8 KB)

s1.jpg

最佳答案

jjjj6666 查看完整内容

depending on which way you like, using c(l[.]ll[.]) or c(l[-]ll[-])
关键词:stata程序 Stata tata 求帮忙 Monte-carlo 程序
沙发
jjjj6666 发表于 2014-2-9 10:34:23 |只看作者 |坛友微信交流群
depending on which way you like, using c(l[.]ll[.]) or c(l[-]ll[-])

使用道具

藤椅
jjjj6666 发表于 2014-2-9 11:59:09 |只看作者 |坛友微信交流群
try chaning to "s(.i.) c(.l.)"

使用道具

板凳
snowshen 发表于 2014-2-9 15:33:48 |只看作者 |坛友微信交流群
jjjj6666 发表于 2014-2-9 11:59
try chaning to "s(.i.) c(.l.)"
谢谢,可是出来的是这个样子。。。请看我的帖子的更新。。。

使用道具

报纸
snowshen 发表于 2014-2-9 15:42:15 |只看作者 |坛友微信交流群
jjjj6666 发表于 2014-2-9 11:59
try chaning to "s(.i.) c(.l.)"
我想要的是虚线,我试了 s(-i-) c(-l-) 结果还是一样

使用道具

地板
蓝色 发表于 2014-2-9 15:48:50 |只看作者 |坛友微信交流群
你最好给个数据让别人给你尝试程序
写一个完整的程序

这些公容易尝试和解决

使用道具

7
snowshen 发表于 2014-2-9 17:20:34 |只看作者 |坛友微信交流群
蓝色 发表于 2014-2-9 15:48
你最好给个数据让别人给你尝试程序
写一个完整的程序
你好,谢谢你的提醒,我已上传所有相关文件。

使用道具

8
蓝色 发表于 2014-2-9 18:20:27 |只看作者 |坛友微信交流群
改成

c(l[-]ll[-])

使用道具

9
jjjj6666 发表于 2014-2-10 01:01:22 |只看作者 |坛友微信交流群
for this simple graph, another way in output the data into csv and plot in excel, which may be easier if you are familiar with excel and VBA.

使用道具

10
snowshen 发表于 2014-2-10 08:31:43 |只看作者 |坛友微信交流群
蓝色 发表于 2014-2-9 18:20
改成

c(l[-]ll[-])
谢谢版主帮忙,我决定把论坛币奖给jjjj6666。

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-17 23:29