Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Panel Data Rolling Regression

    Dear all,

    I am currently working with panel data that contains stock market information for numerous companies from 2001-2013. A snap shot of my data is below
    permno date vwretd MktRF SMB HML id
    46703 31-Jan-01 0.039599 3.13 4.95 -2.93 1
    46703 28-Feb-01 -0.0991 -10.05 1.01 9.82 1
    46703 30-Mar-01 -0.07039 -7.26 1.49 3.78 1
    46703 30-Apr-01 0.083831 7.94 -0.56 -2.69 1
    46703 31-May-01 0.010458 0.72 4.46 0.51 1
    87612 31-Jan-01 0.039599 3.13 4.95 -2.93 2
    87612 28-Feb-01 -0.0991 -10.05 1.01 9.82 2
    87612 30-Mar-01 -0.07039 -7.26 1.49 3.78 2
    87612 30-Apr-01 0.083831 7.94 -0.56 -2.69 2
    I would like to be able to calculate the Jensen alpha by regressing the return(vwretd) on the the Fama-French 3 factors (MktRF, SMB, HML) from years 2001 to 2003. I have researched others who have posted a similar question, however, I cannot seem to fit my data into their code.

    An example

    Code:
    gen alpha = .
    gen b_mktrf = .
    gen b_smb = .
    gen b_hml = .
    gen b_umd = .
    qui forval p = 1/`=_N' {
    capture ereturn clear
    capture regress VW_ExcRet_Gr mktrf smb hml umd if crsp_fundno == crsp_fundno[`p'] & inrange(r_year,r_year[`p']-2,r_year[`p'])
    capture replace alpha = _b[_cons] in `p'
    capture replace b_mktrf = _b[mktrf] in `p'
    capture replace b_smb = _b[smb] in `p'
    capture replace b_hml = _b[hml] in `p'
    capture replace b_umd = _b[umd] in `p'
    }
    Will something similar to this work with my data?

    Thank you in advance!

  • #2
    I guess the way Jensen's Alpha is usually discussed implies that you would regress vwretd against MktRF. Beforehand, I would adjust both variables for the risk-free rate. I am not sure whether you did this with your data because you named the market factor MktRF (sounds like an excess return) but the other variable (vwretd) has no RF in its name. Once you have these two excess returns you can run the regression. The intercept that you obtain is called Jensen's Alpha. Running the FF-3-Factor model yields another intercept which is usually not termed this way.

    One idea to run the FF-3-Factor model would be to loop over the different id's in a way that the model is estimated for each fund separately. You could make use of the coefficient vector saved in memory and could copy those entries into the variable like here:

    Code:
    gen b_mkt = .
    gen b_smb = .
    gen b_hml = .
    gen alpha = .
    
    sum id
    local ini = `r(min)'
    local stp = `r(max)'
    forvalues i=`ini'/`stp' {
            quietly regress vwretd MktRF SMB HML if id == `i' //run the regression for each fund separately
            mat A = e(b) 
            //copy the coefficients from the coefficient vector into the variables b_mkt, b_smb, b_hml, alpha
            quietly replace b_mkt = A[1,1] if id == `i'
            quietly replace b_smb = A[1, 2]  if id == `i'
            quietly replace b_hml = A[1, 3]  if id == `i'
            quietly replace alpha = A[1, 4]  if id == `i'
        }

    Comment

    Working...
    X