楼主: maylsm
7892 7

HELP~~~~fama-macbeth regression, PLEASE!!!! [推广有奖]

  • 0关注
  • 4粉丝

大专生

43%

还不是VIP/贵宾

-

威望
0
论坛币
299 个
通用积分
23.1718
学术水平
18 点
热心指数
17 点
信用等级
4 点
经验
2549 点
帖子
74
精华
0
在线时间
25 小时
注册时间
2005-10-28
最后登录
2022-12-20

楼主
maylsm 发表于 2009-8-17 22:41:55 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

I need to run the following fama-macbeth approach regression

Ri = C+B1LogMe+B2LogBTM+B3IdioStdi,1+B4Coskewi,1

+B5RETi,1+B6RETi,7:2+B7RETi,13:8+B8RETi,60:14

+B9IndMeanj,1+B10IndMeanj,2+B11IndMeanj,12:3+B12IndStdj,1

+B13IndSkewj,1+ei,

I am doing my dissertation, I should test the relation btw skewness and stock returns,
I have all data...my tutor helped me to transfer raw data to the useable data with each variable

But I do not know how to run it...shame.....

I googled, and find one ado file, I run it, nothing happens.....so  still do not know how to deal with it

I just know some basic stata command...and some basic test....


ANYONE,
HELP ........ thousands THANKS...............



二维码

扫码加我 拉你入群

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

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

关键词:regression regressio macbeth regress please regression Help

沙发
maylsm 发表于 2009-8-17 22:46:15
I do not know how to attach file....shame....so I paste it......

PLEASE, EN REN, HELP ME!!

藤椅
maylsm 发表于 2009-8-17 23:21:08
program fmregress, eclass
    version 8
    syntax varlist(ts min=2)            ///
        [                               ///
            ,   NOCONStant              ///
                LAG(integer 0)          ///
                DROPFirst(integer 0)    ///
        ]
    *macro list
    *disp("I'm in")
    quietly capture xt_tis `t'
    if _rc {
        disp as err "Use tsset before fmreg"
        exit 111
    }
    *disp("Tsset checked")
   
    quietly summarize `s(timevar)'
    *disp("I've analyzed `s(timevar)'")
    local tmin = r(min) + `dropfirst'
    local tmax = r(max)
    local T = `tmax' - `tmin' + 1
    local tminplus1 = `tmin' + 1
    *disp("Time limits obtained tmin: `tmin' tmax: `tmax' T: `T'")
    * Regressions
    quietly regress `varlist' if `s(timevar)' == `tmin' ///
        , `noconstant'
    *disp("First regression done")
    matrix betas   = e(b) /// these are saved from the regression
    *disp("We have the betas of the first regression")
    matrix NumObs   = `e(N)'
    *disp("We have n of the firt regression")
    quietly forval i = `tminplus1'/`tmax' { /// Loop begins
        regress `varlist' if `s(timevar)' == `i', `noconstant'
        matrix betas     = betas\e(b)
        matrix NumObsAux = `e(N)'
        matrix NumObs    = NumObs\NumObsAux
    }
    *disp("Regressions done")
    matrix U = J(rowsof(betas),1,1)
    *disp("Matrix U constructed")
    matrix beta = U'*betas/rowsof(betas)
    *disp("Coefficients estimated")
    matrix TotObsAux = U'*NumObs
    *disp("Total number of observations computed")
    matrix betasMinusBeta = betas - ///
        J(rowsof(betas),colsof(betas),1)*diag(beta)
    matrix V = betasMinusBeta'*betasMinusBeta / ///
            (rowsof(betasMinusBeta)*(rowsof(betasMinusBeta) - 1))
    *scalar d = det(V)
    *display d
    *disp("VCV matrix of coefficients estimated")
    forval j = 1/`lag' {
        *disp("I'm in the loop for Newey-West correction")
        scalar weight   = 1 - `j'/(1 + `lag')
        scalar lIni = 1 + `j'
        scalar lFin = rowsof(betasMinusBeta) - `j'
        matrix Vaux = ///
            betasMinusBeta[lIni...,1...]'*betasMinusBeta[1..lFin,1...] / ///
            ((rowsof(betasMinusBeta) - `j')*(rowsof(betasMinusBeta) - `j' - 1))
        matrix V = V + weight*(Vaux + Vaux')
    }
    *disp("I'm going to create ereturn")
    *scalar d = det(V)
    *display d
    ereturn post beta V
    *disp("Ereturn created")
    ereturn scalar N = TotObsAux[1,1]
    if "`noconstant'" != "" {
        ereturn scalar df_m = colsof(betas)
    }
    else {
        ereturn scalar df_m = colsof(betas) - 1
    }
    ereturn scalar df_r = e(N) - colsof(betas)
    ereturn scalar lag  = `lag'
    ereturn local cmd "fmregress"
    ereturn local depvar "`1'"
    *disp("ereturn filled")
   
    disp _n in gr ///
        `"Fama MacBeth regression with Newey-West standard errors"'
    disp in gr `"Number of obs  ="' in yel %10.0f e(N)
    disp in gr `"Maximum lag    ="' in ye %10.0f e(lag)   
    ereturn display
   
    matrix drop _all
    scalar drop _all
    *disp("I'm out")
end
*-----------------------------------------------------------------------

板凳
arlionn 在职认证  发表于 2009-8-18 08:14:19
ssc install xtfmb, replace

*------------------
xtfmb is an implementation of the Fama and MacBeth (J. Polit.  Econ. 1973) two step procedure.
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
we7c + 5 + 5 + 5 精彩帖子

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

报纸
maylsm 发表于 2009-8-18 19:37:21
4# arlionn Thanks for your help, arlionn. but still doesnot work It says . ssc install xtfmb, replace connection timed out -- see help r(2) for troubleshooting http://fmwww.bc.edu/repec/bocode/x/ either 1) is not a valid URL, or 2) could not be contacted, or 3) is not a Stata download site (has no stata.toc file). r(2); I load the ado file I can use, but I donot know how to do my regression.

Thanks for your help, arlionn. but still doesnot work
It says
. ssc install xtfmb, replace
connection timed out -- see help r(2) for troubleshooting
http://fmwww.bc.edu/repec/bocode/x/ either
  1)  is not a valid URL, or
  2)  could not be contacted, or
  3)  is not a Stata download site (has no stata.toc file).
r(2);

I load the ado file I can use, but I donot know how to do my regression.

地板
godmom 发表于 2011-7-27 22:15:46
poor girl, bless

7
rayldj 发表于 2011-9-27 01:09:20
哈哈。。版主已经讲得非常清楚了。。。。唉。。。poor girl.....

8
rayldj 发表于 2011-9-27 01:09:57
版主放心,我已经去教他了。。嘿嘿。。。

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

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