楼主: lclray3
9330 17

[回归分析求助] 谁有进行vuong test 的ado文件可以给我一个么? [推广有奖]

  • 0关注
  • 0粉丝

讲师

25%

还不是VIP/贵宾

-

威望
0
论坛币
804 个
通用积分
6.0077
学术水平
5 点
热心指数
5 点
信用等级
5 点
经验
12560 点
帖子
228
精华
0
在线时间
205 小时
注册时间
2013-1-15
最后登录
2025-8-17

楼主
lclray3 发表于 2014-2-23 15:43:47 |AI写论文
5论坛币
我在论坛里找到的vuong的ado文件的命令经过自己整理成ado文件后并不能使用,在运行时总是显示说unexpected end of file
r(612);有谁的vuong.ado文件能使用么?麻烦给我一个,谢谢。


最佳答案

关键词:ado文件 Vuong test do文件 Est unexpected

回帖推荐

jjjj6666 发表于2楼  查看完整内容

try this one

沙发
jjjj6666 发表于 2014-2-23 15:43:48
try this one
  1. ******************************
  2. * vuong.ado
  3. * Judson A. Caskey
  4. * UCLA
  5. * 26-Apr-2007
  6. *
  7. * Computes Vuong (1989 Econometrica) test
  8. * of two non-nested regressions as implemented
  9. * and described in Dechow (1994 Journal of
  10. * Accounting and Economics)
  11. *
  12. ******************************

  13. cap prog drop vuong
  14. prog define vuong, rclass

  15. syntax [anything]

  16. tempname mod1 mod2 rss1 rss2 rsq1 rsq2 n zstat pval nbad
  17. tempvar s1 s2 e1 e2 m

  18. if `"`: word count `anything''"' ~= "2" {
  19.         di as err "You must specify two distinct models"
  20.         exit
  21.         }

  22. est_expand `"`anything'"', min(1) max(2)
  23. local `mod1' : word 1 of `r(names)'
  24. local `mod2' : word 2 of `r(names)'
  25. if "``mod1''"=="``mod2''" {
  26.         di as err "You must specify two distinct models"
  27.         exit
  28.         }

  29. quietly estimates restore ``mod1''
  30. local `rss1'=e(rss)
  31. local `rsq1'=e(r2)
  32. quietly _predict `e1' if e(sample), resid
  33. quietly gen `s1'=e(sample)

  34. quietly estimates restore ``mod2''
  35. local `rss2'=e(rss)
  36. local `rsq2'=e(r2)
  37. quietly _predict `e2' if e(sample), resid
  38. quietly gen `s2'=e(sample)

  39. quietly count if `s1'==1 & `s2'==1 & ~missing(`e1',`e2')
  40. local `n'=r(N)

  41. quietly gen `m'=log(``rss1''/``rss2'')/2 + ``n''*((`e1'^2)/``rss1'' - (`e2'^2)/``rss2'')/2 if `s1'==1 & `s2'==1 & ~missing(`e1',`e2')

  42. quietly reg `m'

  43. local `zstat'=-sqrt((e(N)-1)/e(N))*_b[_cons]/_se[_cons]
  44. local `pval'=(1-normal(abs(``zstat'')))*2

  45. di as result _column(20) "   Model 1"  _column(35) "   Model 2"
  46. di as result "R-Squared" _column(20) %10.4f ``rsq1'' _column(35) %10.4f ``rsq2''
  47. di as result ""
  48. di as result "Vuong Z-Statistic" _column(20) %10.4f ``zstat''
  49. di as result "  p-value" _column(20) %10.4f ``pval''

  50. return scalar r2_1=``rsq1''
  51. return scalar r2_2=``rsq2''
  52. return scalar Z=``zstat''
  53. return scalar p=``pval''

  54. quietly count if (`s1'==1 & `s2'==0) | (`s1'==0 & `s2'==1)
  55. local `nbad'=r(N)
  56. di as result ""
  57. if ``nbad''>0 di as err "``nbad'' observations in one model but not the other"

  58. end
复制代码
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
crystal8832 + 10 + 10 + 3 + 3 + 3 热心帮助其他会员

总评分: 经验 + 10  论坛币 + 10  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

藤椅
lclray3 发表于 2014-2-24 08:43:22
jjjj6666 发表于 2014-2-23 23:55
try this one
谢谢您的耐心的回答,我想再问一下,我是应该将这些代码复制到txt文本中,然后将扩展名更改为ado,然后再怎么处理这个ado文件呢?可不可以将文件改为do文件?

板凳
jjjj6666 发表于 2014-2-24 10:44:54
it's better to save as vuong.ado file and put under "c:\ado\personal" or c"\ado"  (the default, using command adopath inside your stata and see if that path is there), then just run vuong as a stata command.

报纸
lclray3 发表于 2014-2-25 08:59:38
jjjj6666 发表于 2014-2-24 10:44
it's better to save as vuong.ado file and put under "c:\ado\personal" or c"\ado"  (the default, usin ...
感谢您耐心的回答,但是我按照您指导的方法做之后,在进行检验时出现了下面的提示:

. vuong m1 m2
unexpected end of file
(error occurred while loading vuong.ado)
r(612);

其中:m1是第一个回归的结果
         m2是第二个回归的结果
请问这是什么原因呢?

地板
jjjj6666 发表于 2014-2-25 09:15:47
vuong.txt (1.93 KB)

did you put the whole thing in vuong.ado.  I attached the file vuong.txt, rename it as vuong.ado, and try.  I tried it and works fine.
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
Sunknownay + 3 + 3 + 3 热心帮助其他会员

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

7
lclray3 发表于 2014-2-25 17:34:52
jjjj6666 发表于 2014-2-25 09:15
did you put the whole thing in vuong.ado.  I attached the file vuong.txt, rename it as vuong.ado ...
恩恩,我也可以用了,是我之前没弄好,真是太感谢您了。

8
only4070 发表于 2014-3-12 19:36:55
抱歉想请问一下,我按照上面的方法把txt檔的檔名改成vuong.ado
也丢进ado的文件夹中
但是还是出现
. vuong mod1 mod2
unrecognized command:  vuong
r(199);
請問是怎麼回事呢?

我用的是免安裝的stata 12

9
jjjj6666 发表于 2014-3-12 23:38:32
if you use:

adopath

is the file put into one of the folder specified (for personal ado file)?  Check the folder and make sure the file is named correctly.

10
only4070 发表于 2014-3-17 16:14:49
不好意思,按照上面的方法再试一次又可以了
不过遇到另一个问题,我的资料是panel data

用这个vuong test的ado会出现
. vuong modA modB
option resid not allowed

请问为什么会这样呢是我设定哪里有问题吗?
谢谢您的回复,感激不尽

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 03:29