楼主: lnulxg
4311 32

[编程问题求助] 编程我不会,只有求助朋友们帮助了! [推广有奖]

21
蓝色 发表于 2015-3-11 21:27:37
这是需要懂计量经济学理论和stata语言

22
夏目贵志 发表于 2015-3-13 09:03:41
本科能教到这个程度,学校应该不错。不过这个明显也不到研究生的水平,所以努努力还是能搞定的。楼主加油!

23
lnulxg 发表于 2015-3-13 11:04:43
谢谢,一起学习吧

24
lnulxg 发表于 2015-3-14 17:43:38
前面说过这是国外大学计量课程的一个作业,老师要求读书后回答有关问题

25
lnulxg 发表于 2015-3-16 09:35:40
从这作业看:外教的启发性是主要的,而我们让学生做的作业多为既定模式的复制!我们一些老师仅是多看了点外文资料,就学会了赚钱,学会了写书,特别是在当前教育部长明确提出不能使用外文原版教材之时!我感到了一种莫名的悲哀,这个民族还能进步吗?

26
lnulxg 发表于 2015-3-17 16:27:46
不过这个明显也不到研究生的水平,所以努努力还是能搞定的.
哪位可以回答一下第三个问题呢?

27
lnulxg 发表于 2015-3-17 21:34:53
看了一下,本帖刚好一月满,却没有朋友讲一点相关思路,可我还在思考该如何回答仍不得其解啊!?

28
lnulxg 发表于 2015-3-18 13:26:21
3) Hard part of the assignment. In their provocative textbook, Mostly Harmless
   Econometrics, Josh Angrist and Jorn-Steffen Pischke argue (albeit in a
   slightly different context) that a better approach to dealing with
   heteroskdasticity than using heteroskdasticity consistent standard
   errors is to estimate BOTH the traditional OLS std error and the
   heteroskedasticity consistent one and to use the larger of the two for
   inference. Modify the code above to explore this contention in a  
   limited -- i.e., choose case specific -- Monte Carlo consistent
   with the the approach above).

29
lnulxg 发表于 2015-3-18 13:27:01
Warning: Relevant for (2) and (3). As currently written the Monte Carlo above
                 does not track many
                 features of the regressions being performed. For example, it does not
                 list the R2. If your Monte Carlo tests an extreme
                 case (say R2 = 0.001 or 0.98 -- that is, one extreme or the other)
                 this might be more or less interesting than a more "typical" case.
                 Extreme cases are OK, but you should be aware about whether the
                 case you are looking at is "typical" or not. For example,
                 most simple cross-sectional regressions in many areas of
                 economics have R2's of between 0.10 and 0.40; few would have R2's
                 of, say, 0.98 (although an R2 of 0.98 might be common in time series).

30
lnulxg 发表于 2015-3-18 21:45:42
capture clear all
capture program drop hetero
program hetero, rclass
        clear
        args obs c
        set obs `obs'
        scalar df = `obs' - 2
        g x1 = rnormal(0,15)
        g error = rnormal(0,1) + rnormal(0,1)*x1*`c'
        egen double MeanError = mean(error)
        egen double SDError   = sd(error)
        replace error = ((error-MeanError)/SDError)*50
        g y  = 1 + 2*x1 + error
        reg  y x1
        
        return scalar b_ols                 = _b[x1]
        return scalar se_ols                 = _se[x1]
        
        return scalar p_ols1         = 2 * ttail(df, (abs(_b[x1]-2))/_se[x1])
        test x1=2
        return scalar p_ols2                = r(p)
        
        reg  y x1, vce(robust)
        
        return scalar b_r                 = _b[x1]
        return scalar se_r                 = _se[x1]
        return scalar p_r1       = 2 * ttail(df, (abs(_b[x1]-2))/_se[x1])
        test x1=2
        return scalar p_r2                = r(p)
end
这就是一个完整的程序,可以运行的。

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

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